Answer the question
In order to leave comments, you need to log in
How to execute php script via cron?
The rights to execute the script are worth it.
The server is ubuntu.
I open crontab through the console crontab -e
,
then I write to run the script every 5 minutes
*/5 * * * * /usr/bin/php /var/site.ru/script.php >/dev/null 2>&1
Answer the question
In order to leave comments, you need to log in
Well, first try to run the script manually from the console in the same way as you try in the cron, that is, by entering the command /usr/bin/php /var/site.ru/script.php
and see what it will answer.
I use Vesta CP
Command:
/usr/bin/php /usr/bin/php /home/admin/web/sat/public_html/cronjob/check-nocredited.php
gives an error:
/usr/bin$ /usr/bin/php / usr/bin/php /home/admin/web/sat/public_html/cronjob/check-nocredited.php
PHP Warning: PHP Startup: Unable to load dynamic library 'php_pdo_sqlsrv_74_nts.so' (tried: /usr/lib64/php/modules /php_pdo_sqlsrv_74_nts.so (/usr/lib64/php/modules/php_pdo_sqlsrv_74_nts.so: undefined symbol: php_pdo_register_driver), /usr/lib64/php/modules/php_pdo_sqlsrv_74_nts.so.so (/usr/lib64/php/modules/php_pdo_sqlsrv_74. so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: Module 'sqlsrv' already loaded in Unknown on line 0
PHP Parse error: syntax error, unexpected '&', expecting end of file in /usr/bin/php on line 3341
the php file itself works.
What could be the problem?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question