I'm being really thick... I've got various crons setup that run php scripts, and unfortunately my server went belly up recently so had to start from scratch. Got all the php files, and crontab list, but having problems running php from the crontab.
I know I had to put link in a "safe directory" to run php from, but can't remember how I did it... can anyone give me a hint, and this time I'll write down what I did!
Thanks
Nunners
Running php from crontab
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Running php from crontab
Depends. Is it /etc/crontab or a specific user's crontab?
As long as the php files are readable by the user who owns the crontab, then everything should be fine if you run them like: /usr/bin/php /path/to/file.php
If you run them like: /path/to/file.php because you have a #!/usr/bin/php at the top of the files, then the PHP file needs to be readable and executable by the user.
-Shawn
As long as the php files are readable by the user who owns the crontab, then everything should be fine if you run them like: /usr/bin/php /path/to/file.php
If you run them like: /path/to/file.php because you have a #!/usr/bin/php at the top of the files, then the PHP file needs to be readable and executable by the user.
-Shawn
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
- kaisellgren
- DevNet Resident
- Posts: 1675
- Joined: Sat Jan 07, 2006 5:52 am
- Location: Lahti, Finland.
Re: Running php from crontab
Make sure the file is indeed executable by the user. Once I wondered for a while why my crons failed.
Also, it's likely a good idea to place the file below the doc root.