i have a php script that should be run automatically every day. as the php script is run on a request,how can i do it? is there any way else using cronjob task?
Open powershell and type c:\php\php.exe -h , you will get the php help output. Yay you are up and running, whoot. Type env into os search (cortana) and select environmental variables. Now you can run php in powershell with php ( php -h to test).
Two options:
The choice is yours :)
To use crontab, type crontab -e
in console, the text file opens. Add a line at the end:
0 0 * * * /usr/bin/php /var/www/mysite/httpdocs/daily_stats.php
Where:
0 0 * * *
- run every day at 00:00
/usr/bin/php
-path to your PHP (can be determined by which php
command)
/var/www/mysite/httpdocs/daily_stats.php
- path to your PHP script
if which php
outputs nothing, install PHP cli by running:
sudo aptitude install php5-cli
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With