I had the same problem with the same configuration. For whatever reason, after installing php-fpm months ago, I just now noticed PHP wasn't in the path. The php-cli script couldn't find php, I couldn't find php, phpinfo() didn't help, where was it? Essentially, installing "php-cli" put php back in the path. All my websites were running fine but my php-cli script stopped working because php was gone, I just didn't notice till last night.
The solution that worked for me:
Step 1
yum install php-cli
====================================================================================================================== Package Arch Version
Repository Size
====================================================================================================================== Installing: php-cli x86_64
5.4.13-1.el6.remi remi 2.6 M Updating for dependencies: php-common x86_64
5.4.13-1.el6.remi remi 891 k php-fpm x86_64 5.4.13-1.el6.remi
remi 1.3 M php-mysql x86_64
5.4.13-1.el6.remi remi 134 k php-pdo x86_64 5.4.13-1.el6.remi
remi 117 k
Transaction Summary
====================================================================================================================== Install 1 Package(s) Upgrade 4 Package(s)
Total download size: 5.0 M Is this ok [y/N]: y
Hopefully this upgrade doesn't break anything.
Note: I had to add "Remi" repository to get php-fpm. I really thought php-cli was already installed because this PHP script had been working for months. The script stopped working around the time I switched to php-fpm.
Step 2
Removed #!whatever from first line of script.
php -l myscript.php
"No syntax errors detected in myscript.php"
Woot!
Step 3
Updated my crontab with "-f" parameter:
43 * * * * someuser php -f /home/getposts/myscript.php
Works!
define("IN_MYBB", 1);– Spencer Aug 25 '11 at 19:53