linux - How to run PHP script at a certain time using at command? -


i need run php script once @ specific time. i'm doing by:

shell_exec('echo /usr/local/bin/php /home/xxx/public_html/yyy.php param1 | /usr/bin/at + 1 minutes'); 

yyy.php takes param1 $_server['argv'][1] , thing based on value. i've tested yyy.php , script works should. problem i'm running can't seem at command execute php script. i've tried different variants, such as:

shell_exec('/usr/local/bin/php /home/xxx/public_html/yyy.php param1 | /usr/bin/at + 1 minutes');  shell_exec('echo "/usr/local/bin/php /home/xxx/public_html/yyy.php param1" | /usr/bin/at + 1 minutes'); 

nothing works. i've double checked , made sure at command being queued calling atq in terminal -- job shows up. think issue how i've setup at command. ideas? thanks!

after work, worked me:

a) chmod yyy.php 755

b) use shell_exec('cd /home/xxx && echo "/usr/local/bin/php /home/xxx/public_html/yyy.php param1" | /usr/bin/at + 1 minutes'); in php script


Comments