Skip to content
Advertisement

php automation for some tasks

i must call a php function every second

if i place it in a php file it runs a few times every call php file when calling an user

index.php

JavaScript

or must i call it in server side ? (i dont know what is right way and how to make it runs in server side maybe linux can have a program for this. like schuled tasks. )

Advertisement

Answer

You can do an infinite while whith an sleep() of 1 second. But remember to increase the set_time_limit() and use “break” to end the loop.

And if you need to execute a PHP script from the server site on Linux, you can execute it typing “php index.php”.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement