I have nginx and php-fpm installed on my Centos vps box. I need to add a cronjob to execute a script every 10 minutes. I tried crontab -e with the following in it:

*/10 * * * * /path/to/script/script.php

However, it's not executing properly. It says there is errors in the php code and there isn't

--

Error when attempting to install php-cli

--> Running transaction check
---> Package php-cli.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php-cli
--> Finished Dependency Resolution
php-cli-5.1.6-27.el5_5.3.i386 from base has depsolving problems
  --> Missing Dependency: php-common = 5.1.6-27.el5_5.3 is needed by package php-cli-5.1.6-27.el5_5.3.i386 (base)
Error: Missing Dependency: php-common = 5.1.6-27.el5_5.3 is needed by package php-cli-5.1.6-27.el5_5.3.i386 (base)
link|improve this question
Please include the error messages your receiving. – David Aug 25 '11 at 19:50
It says there's something with the first line. This is the first line: define("IN_MYBB", 1); – Spencer Aug 25 '11 at 19:53
feedback

2 Answers

up vote 1 down vote accepted

php-fpm is fastcgi only.. install the php-cli package also

edit

You have to enable the repo to install

yum -y --enablerepo=webtatic install php-cli
link|improve this answer
I updated your post with the errors it gives when when trying to install php-cli. – Spencer Aug 25 '11 at 22:12
i don't see an update – Mike Aug 26 '11 at 2:10
I updated my post instead...I guess it won't let me edit your post. – Spencer Aug 26 '11 at 2:24
how did you install php-fpm? – Mike Aug 26 '11 at 3:42
show 2 more comments
feedback

Without seeing the errors it's hard to know, but I'd say it's one of:

  • The script is executable but missing #!/usr/bin/php at the beginning.
  • The script has #!/usr/bin/php but is not executeable.
  • The script is not executable and doesn't have #!/usr/bin/php so crond doesn't know how to properly handle it.

If you change your cron to:

*/10 * * * * /usr/bin/php /path/to/script/script.php

Does it work?

link|improve this answer
/usr/bin/php doesn't exist...I have php-fpm installed. – Spencer Aug 25 '11 at 20:05
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.