[PHP] Still no luck running a PHPCLI script from CRON
Ok, by looking at my cron logs it looks like cron is trying to run my PHP CLI script. However, it is not running it. I only have one line of code that isn't commented out and the line simply sends me an email using the PHP mail() function. Tom suggested that maybe the script is running, but cron may simply not be able to send email VIA the PHP function. I am not sure whether or not this may be true, all I know is that I can't run any PHP script from cron. The only reason I am trying to have cron send me an email is to check to see if cron was running my PHP script. My script is for batch order processing and it hasn't been processing my orders. After immediately realizing this I added the mail() function to see if the script was running. I got no email. I then eliminated the script down to just the mail() function be commenting out my batch order processing code. It still didn't run. Here is my cron log: Mar 3 09:05:00 prod /usr/sbin/cron[3124]: (user) CMD (/path/to/cron_script.file) Mar 3 09:06:00 prod /usr/sbin/cron[3134]: (user) CMD (/path/to/cron_script.file) Mar 3 09:07:00 prod /usr/sbin/cron[3141]: (user) CMD (/path/to/cron_script.file) Mar 3 09:08:00 prod /usr/sbin/cron[3148]: (user) CMD (/path/to/cron_script.file) I have tried running this as user and as root. I get the same results with both. Again, my PHP script runs fine if I run it by hand from the command line via ./cron_script.file Anymore help on this issue would be greatly appreciated. Thanks again XXX Hi, Monday, March 3, 2003, 2:54:47 PM, you wrote: JMC Tom, JMC Did you run the script from cron? If so, what operating system are you JMC using? Putting PHP info in my script won't do me any good since cron JMC won't run it. The trouble is that cron does nothing. When I run the JMC email script I get no mail. If I run the script from the command line JMC by hand ./script_name etc it works fine. JMC Any other ideas would be great. JMC Thanks JMC JMC X JMC Hi, JMC Monday, March 3, 2003, 6:33:46 AM, you wrote: JMC Does anyone have a PHP CLI script running from cron? JMC If so I would greatly appreciate any assistance. Below is JMC everything JMC from this on going problem. It seems none has an answer so far. JMC Please help. JMC JMC XXX JMC I tried to run the script directly from cron like: JMC * * * * * /usr/local/bin/php -q /path/to/cron/script/file_name JMC I also tried to run cron in the bash environment by writing a bash JMC script that calls my PHP script. I set cron you call the bash JMC script JMC every minute. The bash script contained the following information: JMC START SCRIPT JMC = JMC #!/usr/local/bin/bash JMC /path/to/PHP/script/file_name JMC = END SCRIPT JMC == JMC If I run the bash script from the command line it definitely runs JMC my PHP JMC script. I know this because my PHP script sends me an email. JMC Also, if I run my PHP script from the command line it also runs JMC fine and JMC I receive an email. However, anytime I try to run PHP script or JMC the JMC bash script from cron nothing happens. I get no emails. I also JMC know JMC cron is working properly because a regular bash script as I listed JMC in my JMC earlier posting works fine. JMC This is using the new CLI that come with PHP 4.3 I have in past JMC versions JMC of used the CGI from cron with no problems at all. As a matter of JMC fact JMC I have another server that does all its maintenance via PHP scripts JMC that JMC get ran by cron JMC Here is the PHP CLI cron script I am testing to see if cron will JMC run my JMC PHP JMC START SCRIPT JMC = JMC #!/usr/local/bin/php -q JMC ? JMC mail([EMAIL PROTECTED],Message From cron,date(F j, Y @ h:i JMC a)); ? JMC = END SCRIPT JMC == JMC Any more suggestions would be greatly appreciated. JMC Justin JMC -Original Message- JMC From: CodersNightMare [mailto:[EMAIL PROTECTED] JMC Sent: Friday, February 28, 2003 10:32 AM JMC To: [EMAIL PROTECTED] JMC Subject: RE: [PHP] Can't run PHP cli script from Cron JMC I am sure you have tried this, but, JMC Do you call the full path to php for cron. JMC something like: JMC 40 * * * * /usr/local/bin/php -q /home/user/phpcliscript JMC Hope this helps. JMC At 10:10 AM 2/28/2003 -0800, you wrote: The path is #!/usr/local/bin/php -q But like I said, that can't be the problem because when I run it from the command line, it runs fine. The only problem I am having is that JMC it won't run from cron. That is why I think it is an issue with the cron environment. All
Re: [PHP] Still no luck running a PHPCLI script from CRON
Ok, by looking at my cron logs it looks like cron is trying to run my PHP CLI script. However, it is not running it. I only have one line of code that isn't commented out and the line simply sends me an email using the PHP mail() function. One thing to keep in mind when working with crontab is environmental variables. As in, Cron has none. You have to set any you want in your crontab, or your called scripts. For example, use full paths. You shouldnt have to call a shell before calling the php cli. Here is an example script for you to test. My php binary is in /usr/local/bin/php, my script is /usr/local/crontab-scripts/wibble.php and the file I am writing to is in /tmp/wibble.output This is what wibble looks like [chmoded to 755, owned by the user of the crontab]: #!/usr/local/bin/php -q ?php if ($fp = fopen(/tmp/wibble.output,a)) { fputs($fp, Script Executed on .date(YmdHis).\n); fclose($fp); } else { die(Could not open 'wibble.output' for read / write operations); } ? and the crontab line I have is: * * * * /usr/local/contab-scripts/wibble.php and you can see the output of it running every minute: tail -f /tmp/wibble.output Works fine for me ... try it -- Dan Hardiker [EMAIL PROTECTED] ADAM Software Systems Engineer First Creative -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Still no luck running a PHPCLI script from CRON
Dan, I used your example exactly like you have it specified. My cron log looks like this: Mar 3 15:53:00 prod /usr/sbin/cron[3085]: (root) CMD (/usr/local/contab-scripts/wibble.php) Mar 3 15:54:00 prod /usr/sbin/cron[3085]: (root) CMD (/usr/local/contab-scripts/wibble.php) However, it does nothing at all. It doesn't create the /tmp/wibble.output file. After testing this, I went in and ran the wibble.php script by hand from the command line and it worked just as my scripts work when I run them by hand. I ran the cron as root and ran the script by hand as root. I really think there is a bug somewhere, either in FreeBSD or in PHP. I am not sure what it can be. All I know is that other scripts like bash scripts run fine from cron. This problem is really weird and I would truly appreciate any more assistance in getting it resolved. Thanks everyone, XX Ok, by looking at my cron logs it looks like cron is trying to run my PHP CLI script. However, it is not running it. I only have one line of code that isn't commented out and the line simply sends me an email using the PHP mail() function. One thing to keep in mind when working with crontab is environmental variables. As in, Cron has none. You have to set any you want in your crontab, or your called scripts. For example, use full paths. You shouldnt have to call a shell before calling the php cli. Here is an example script for you to test. My php binary is in /usr/local/bin/php, my script is /usr/local/crontab-scripts/wibble.php and the file I am writing to is in /tmp/wibble.output This is what wibble looks like [chmoded to 755, owned by the user of the crontab]: #!/usr/local/bin/php -q ?php if ($fp = fopen(/tmp/wibble.output,a)) { fputs($fp, Script Executed on .date(YmdHis).\n); fclose($fp); } else { die(Could not open 'wibble.output' for read / write operations); } ? and the crontab line I have is: * * * * /usr/local/contab-scripts/wibble.php and you can see the output of it running every minute: tail -f /tmp/wibble.output Works fine for me ... try it -- Dan Hardiker [EMAIL PROTECTED] ADAM Software Systems Engineer First Creative -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Still no luck running a PHPCLI script from CRON
Hi, Tuesday, March 4, 2003, 10:01:25 AM, you wrote: JMC Dan, JMC I used your example exactly like you have it specified. My cron log JMC looks like this: JMC Mar 3 15:53:00 prod /usr/sbin/cron[3085]: (root) CMD JMC (/usr/local/contab-scripts/wibble.php) JMC Mar 3 15:54:00 prod /usr/sbin/cron[3085]: (root) CMD JMC (/usr/local/contab-scripts/wibble.php) JMC However, it does nothing at all. It doesn't create the JMC /tmp/wibble.output file. After testing this, I went in and ran the JMC wibble.php script by hand from the command line and it worked just as my JMC scripts work when I run them by hand. I ran the cron as root and ran JMC the script by hand as root. I really think there is a bug somewhere, JMC either in FreeBSD or in PHP. I am not sure what it can be. All I know JMC is that other scripts like bash scripts run fine from cron. This JMC problem is really weird and I would truly appreciate any more assistance JMC in getting it resolved. JMC Thanks everyone, JMC XX Ok, by looking at my cron logs it looks like cron is trying to run my PHP CLI script. However, it is not running it. I only have one line JMC of code that isn't commented out and the line simply sends me an email using the PHP mail() function. JMC One thing to keep in mind when working with crontab is environmental JMC variables. As in, Cron has none. You have to set any you want in your JMC crontab, or your called scripts. For example, use full paths. JMC You shouldnt have to call a shell before calling the php cli. Here is an JMC example script for you to test. My php binary is in /usr/local/bin/php, JMC my JMC script is /usr/local/crontab-scripts/wibble.php and the file I am JMC writing JMC to is in /tmp/wibble.output JMC This is what wibble looks like [chmoded to 755, owned by the user of the JMC crontab]: JMC #!/usr/local/bin/php -q JMC ?php JMC if ($fp = fopen(/tmp/wibble.output,a)) { JMC fputs($fp, Script Executed on .date(YmdHis).\n); JMC fclose($fp); JMC } else { JMC die(Could not open 'wibble.output' for read / write operations); JMC } ? JMC and the crontab line I have is: JMC * * * * /usr/local/contab-scripts/wibble.php JMC and you can see the output of it running every minute: JMC tail -f /tmp/wibble.output JMC Works fine for me ... try it JMC -- JMC Dan Hardiker [EMAIL PROTECTED] JMC ADAM Software Systems Engineer JMC First Creative JMC -- JMC PHP General Mailing List (http://www.php.net/) JMC To unsubscribe, visit: http://www.php.net/unsub.php Try removing the -q's and see if root or whatever user cron runs as gets an email with an error message in it, as cron is actully having a crack at running the script. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Still no luck running a PHPCLI script from CRON -- getting closer
I have my PHP script running from cron now as root, but when I try to run it as a non root user it doesn't work. When I drop down to the non root user and run the script by hand I get this. /usr/libexec/ld-elf.so.1: Shared object libmysqlclient.so.12 not found any ideas why this wouldn't not happen as root but does as a non root user? thanks Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 6:23 PM To: Justin Michael Couto Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re[2]: [PHP] Still no luck running a PHPCLI script from CRON Hi, Tuesday, March 4, 2003, 10:01:25 AM, you wrote: JMC Dan, JMC I used your example exactly like you have it specified. My cron log JMC looks like this: JMC Mar 3 15:53:00 prod /usr/sbin/cron[3085]: (root) CMD JMC (/usr/local/contab-scripts/wibble.php) JMC Mar 3 15:54:00 prod /usr/sbin/cron[3085]: (root) CMD JMC (/usr/local/contab-scripts/wibble.php) JMC However, it does nothing at all. It doesn't create the JMC /tmp/wibble.output file. After testing this, I went in and ran the JMC wibble.php script by hand from the command line and it worked just as my JMC scripts work when I run them by hand. I ran the cron as root and ran JMC the script by hand as root. I really think there is a bug somewhere, JMC either in FreeBSD or in PHP. I am not sure what it can be. All I know JMC is that other scripts like bash scripts run fine from cron. This JMC problem is really weird and I would truly appreciate any more assistance JMC in getting it resolved. JMC Thanks everyone, JMC XX Ok, by looking at my cron logs it looks like cron is trying to run my PHP CLI script. However, it is not running it. I only have one line JMC of code that isn't commented out and the line simply sends me an email using the PHP mail() function. JMC One thing to keep in mind when working with crontab is environmental JMC variables. As in, Cron has none. You have to set any you want in your JMC crontab, or your called scripts. For example, use full paths. JMC You shouldnt have to call a shell before calling the php cli. Here is an JMC example script for you to test. My php binary is in /usr/local/bin/php, JMC my JMC script is /usr/local/crontab-scripts/wibble.php and the file I am JMC writing JMC to is in /tmp/wibble.output JMC This is what wibble looks like [chmoded to 755, owned by the user of the JMC crontab]: JMC #!/usr/local/bin/php -q JMC ?php JMC if ($fp = fopen(/tmp/wibble.output,a)) { JMC fputs($fp, Script Executed on .date(YmdHis).\n); JMC fclose($fp); JMC } else { JMC die(Could not open 'wibble.output' for read / write operations); JMC } ? JMC and the crontab line I have is: JMC * * * * /usr/local/contab-scripts/wibble.php JMC and you can see the output of it running every minute: JMC tail -f /tmp/wibble.output JMC Works fine for me ... try it JMC -- JMC Dan Hardiker [EMAIL PROTECTED] JMC ADAM Software Systems Engineer JMC First Creative JMC -- JMC PHP General Mailing List (http://www.php.net/) JMC To unsubscribe, visit: http://www.php.net/unsub.php Try removing the -q's and see if root or whatever user cron runs as gets an email with an error message in it, as cron is actully having a crack at running the script. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Still no luck running a PHPCLI script from CRON
Does anyone have a PHP CLI script running from cron? If so I would greatly appreciate any assistance. Below is everything from this on going problem. It seems none has an answer so far. Please help. XXX I tried to run the script directly from cron like: * * * * * /usr/local/bin/php -q /path/to/cron/script/file_name I also tried to run cron in the bash environment by writing a bash script that calls my PHP script. I set cron you call the bash script every minute. The bash script contained the following information: START SCRIPT = #!/usr/local/bin/bash /path/to/PHP/script/file_name = END SCRIPT == If I run the bash script from the command line it definitely runs my PHP script. I know this because my PHP script sends me an email. Also, if I run my PHP script from the command line it also runs fine and I receive an email. However, anytime I try to run PHP script or the bash script from cron nothing happens. I get no emails. I also know cron is working properly because a regular bash script as I listed in my earlier posting works fine. This is using the new CLI that come with PHP 4.3 I have in past versions of used the CGI from cron with no problems at all. As a matter of fact I have another server that does all its maintenance via PHP scripts that get ran by cron Here is the PHP CLI cron script I am testing to see if cron will run my PHP START SCRIPT = #!/usr/local/bin/php -q ? mail([EMAIL PROTECTED],Message From cron,date(F j, Y @ h:i a)); ? = END SCRIPT == Any more suggestions would be greatly appreciated. Justin -Original Message- From: CodersNightMare [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 10:32 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Can't run PHP cli script from Cron I am sure you have tried this, but, Do you call the full path to php for cron. something like: 40 * * * * /usr/local/bin/php -q /home/user/phpcliscript Hope this helps. At 10:10 AM 2/28/2003 -0800, you wrote: The path is #!/usr/local/bin/php -q But like I said, that can't be the problem because when I run it from the command line, it runs fine. The only problem I am having is that it won't run from cron. That is why I think it is an issue with the cron environment. All other types of scripts like bash scripts run fine from cron. I am surprised no one else has come across this problem before. Please help me! Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 9:44 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can't run PHP cli script from Cron Shouldn't it be #!/usr/local/bin/php Or was it just a typo here? - Original Message - From: Justin Michael Couto [EMAIL PROTECTED] To: 'Ernest E Vogelsinger' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:09 PM Subject: RE: [PHP] Can't run PHP cli script from Cron I can run it from the shell prompt perfectly fine. I just won't run from cron. I do have the statement: #!/usr/local/php In the beginning of my script. Like I said it works perfect when I run it by hand from the shell prompt. I think the reason it is not running has to do with the cron environment, but I am not ssure what it is. Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:55 AM To: Justin Michael Couto Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can't run PHP cli script from Cron At 05:30 28.02.2003, Justin Michael Couto said: [snip] Here is my crontab entry: * * * * * /path/to/file/file_name.php I also have * * * * * /path/to/file/bash_test_script [snip] Did you try to run the php file interactively, from the shell prompt? You need at last this statement on top of your PHP files: #!/usr/local/php -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
Re: [PHP] Still no luck running a PHPCLI script from CRON
Hi, Monday, March 3, 2003, 6:33:46 AM, you wrote: JMC Does anyone have a PHP CLI script running from cron? JMC If so I would greatly appreciate any assistance. Below is everything JMC from this on going problem. It seems none has an answer so far. JMC Please help. JMC XXX JMC I tried to run the script directly from cron like: JMC * * * * * /usr/local/bin/php -q /path/to/cron/script/file_name JMC I also tried to run cron in the bash environment by writing a bash JMC script that calls my PHP script. I set cron you call the bash script JMC every minute. The bash script contained the following information: JMC START SCRIPT JMC = JMC #!/usr/local/bin/bash JMC /path/to/PHP/script/file_name JMC = END SCRIPT JMC == JMC If I run the bash script from the command line it definitely runs my PHP JMC script. I know this because my PHP script sends me an email. JMC Also, if I run my PHP script from the command line it also runs fine and JMC I receive an email. However, anytime I try to run PHP script or the JMC bash script from cron nothing happens. I get no emails. I also know JMC cron is working properly because a regular bash script as I listed in my JMC earlier posting works fine. JMC This is using the new CLI that come with PHP 4.3 I have in past versions JMC of used the CGI from cron with no problems at all. As a matter of fact JMC I have another server that does all its maintenance via PHP scripts that JMC get ran by cron JMC Here is the PHP CLI cron script I am testing to see if cron will run my JMC PHP JMC START SCRIPT JMC = JMC #!/usr/local/bin/php -q JMC ? JMC mail([EMAIL PROTECTED],Message From cron,date(F j, Y @ h:i a)); ? JMC = END SCRIPT JMC == JMC Any more suggestions would be greatly appreciated. JMC Justin JMC -Original Message- JMC From: CodersNightMare [mailto:[EMAIL PROTECTED] JMC Sent: Friday, February 28, 2003 10:32 AM JMC To: [EMAIL PROTECTED] JMC Subject: RE: [PHP] Can't run PHP cli script from Cron JMC I am sure you have tried this, but, JMC Do you call the full path to php for cron. JMC something like: JMC 40 * * * * /usr/local/bin/php -q /home/user/phpcliscript JMC Hope this helps. JMC At 10:10 AM 2/28/2003 -0800, you wrote: The path is #!/usr/local/bin/php -q But like I said, that can't be the problem because when I run it from the command line, it runs fine. The only problem I am having is that JMC it won't run from cron. That is why I think it is an issue with the cron environment. All other types of scripts like bash scripts run fine JMC from cron. I am surprised no one else has come across this problem before. Please help me! Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 9:44 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can't run PHP cli script from Cron Shouldn't it be #!/usr/local/bin/php Or was it just a typo here? - Original Message - From: Justin Michael Couto [EMAIL PROTECTED] To: 'Ernest E Vogelsinger' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:09 PM Subject: RE: [PHP] Can't run PHP cli script from Cron I can run it from the shell prompt perfectly fine. I just won't run from cron. I do have the statement: #!/usr/local/php In the beginning of my script. Like I said it works perfect when I run it by hand from the shell prompt. I think the reason it is not running has to do with the cron environment, but I am not ssure what it is. Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:55 AM To: Justin Michael Couto Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can't run PHP cli script from Cron At 05:30 28.02.2003, Justin Michael Couto said: [snip] Here is my crontab entry: * * * * * /path/to/file/file_name.php I also have * * * * * /path/to/file/bash_test_script [snip] Did you try to run the php file interactively, from the shell JMC prompt? You need at last this statement on top of your PHP files: #!/usr/local/php -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List
RE: [PHP] Still no luck running a PHPCLI script from CRON
Tom, Did you run the script from cron? If so, what operating system are you using? Putting PHP info in my script won't do me any good since cron won't run it. The trouble is that cron does nothing. When I run the email script I get no mail. If I run the script from the command line by hand ./script_name etc it works fine. Any other ideas would be great. Thanks X Hi, Monday, March 3, 2003, 6:33:46 AM, you wrote: JMC Does anyone have a PHP CLI script running from cron? JMC If so I would greatly appreciate any assistance. Below is everything JMC from this on going problem. It seems none has an answer so far. JMC Please help. JMC XXX JMC I tried to run the script directly from cron like: JMC * * * * * /usr/local/bin/php -q /path/to/cron/script/file_name JMC I also tried to run cron in the bash environment by writing a bash JMC script that calls my PHP script. I set cron you call the bash script JMC every minute. The bash script contained the following information: JMC START SCRIPT JMC = JMC #!/usr/local/bin/bash JMC /path/to/PHP/script/file_name JMC = END SCRIPT JMC == JMC If I run the bash script from the command line it definitely runs my PHP JMC script. I know this because my PHP script sends me an email. JMC Also, if I run my PHP script from the command line it also runs fine and JMC I receive an email. However, anytime I try to run PHP script or the JMC bash script from cron nothing happens. I get no emails. I also know JMC cron is working properly because a regular bash script as I listed in my JMC earlier posting works fine. JMC This is using the new CLI that come with PHP 4.3 I have in past versions JMC of used the CGI from cron with no problems at all. As a matter of fact JMC I have another server that does all its maintenance via PHP scripts that JMC get ran by cron JMC Here is the PHP CLI cron script I am testing to see if cron will run my JMC PHP JMC START SCRIPT JMC = JMC #!/usr/local/bin/php -q JMC ? JMC mail([EMAIL PROTECTED],Message From cron,date(F j, Y @ h:i a)); ? JMC = END SCRIPT JMC == JMC Any more suggestions would be greatly appreciated. JMC Justin JMC -Original Message- JMC From: CodersNightMare [mailto:[EMAIL PROTECTED] JMC Sent: Friday, February 28, 2003 10:32 AM JMC To: [EMAIL PROTECTED] JMC Subject: RE: [PHP] Can't run PHP cli script from Cron JMC I am sure you have tried this, but, JMC Do you call the full path to php for cron. JMC something like: JMC 40 * * * * /usr/local/bin/php -q /home/user/phpcliscript JMC Hope this helps. JMC At 10:10 AM 2/28/2003 -0800, you wrote: The path is #!/usr/local/bin/php -q But like I said, that can't be the problem because when I run it from the command line, it runs fine. The only problem I am having is that JMC it won't run from cron. That is why I think it is an issue with the cron environment. All other types of scripts like bash scripts run fine JMC from cron. I am surprised no one else has come across this problem before. Please help me! Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 9:44 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can't run PHP cli script from Cron Shouldn't it be #!/usr/local/bin/php Or was it just a typo here? - Original Message - From: Justin Michael Couto [EMAIL PROTECTED] To: 'Ernest E Vogelsinger' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:09 PM Subject: RE: [PHP] Can't run PHP cli script from Cron I can run it from the shell prompt perfectly fine. I just won't run from cron. I do have the statement: #!/usr/local/php In the beginning of my script. Like I said it works perfect when I run it by hand from the shell prompt. I think the reason it is not running has to do with the cron environment, but I am not ssure what it is. Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:55 AM To: Justin Michael Couto Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can't run PHP cli script from Cron At 05:30 28.02.2003, Justin Michael Couto said: [snip] Here is my crontab entry: * * * * *
Re[2]: [PHP] Still no luck running a PHPCLI script from CRON
Hi, Monday, March 3, 2003, 2:54:47 PM, you wrote: JMC Tom, JMC Did you run the script from cron? If so, what operating system are you JMC using? Putting PHP info in my script won't do me any good since cron JMC won't run it. The trouble is that cron does nothing. When I run the JMC email script I get no mail. If I run the script from the command line JMC by hand ./script_name etc it works fine. JMC Any other ideas would be great. JMC Thanks JMC JMC X JMC Hi, JMC Monday, March 3, 2003, 6:33:46 AM, you wrote: JMC Does anyone have a PHP CLI script running from cron? JMC If so I would greatly appreciate any assistance. Below is JMC everything JMC from this on going problem. It seems none has an answer so far. JMC Please help. JMC JMC XXX JMC I tried to run the script directly from cron like: JMC * * * * * /usr/local/bin/php -q /path/to/cron/script/file_name JMC I also tried to run cron in the bash environment by writing a bash JMC script that calls my PHP script. I set cron you call the bash JMC script JMC every minute. The bash script contained the following information: JMC START SCRIPT JMC = JMC #!/usr/local/bin/bash JMC /path/to/PHP/script/file_name JMC = END SCRIPT JMC == JMC If I run the bash script from the command line it definitely runs JMC my PHP JMC script. I know this because my PHP script sends me an email. JMC Also, if I run my PHP script from the command line it also runs JMC fine and JMC I receive an email. However, anytime I try to run PHP script or JMC the JMC bash script from cron nothing happens. I get no emails. I also JMC know JMC cron is working properly because a regular bash script as I listed JMC in my JMC earlier posting works fine. JMC This is using the new CLI that come with PHP 4.3 I have in past JMC versions JMC of used the CGI from cron with no problems at all. As a matter of JMC fact JMC I have another server that does all its maintenance via PHP scripts JMC that JMC get ran by cron JMC Here is the PHP CLI cron script I am testing to see if cron will JMC run my JMC PHP JMC START SCRIPT JMC = JMC #!/usr/local/bin/php -q JMC ? JMC mail([EMAIL PROTECTED],Message From cron,date(F j, Y @ h:i JMC a)); ? JMC = END SCRIPT JMC == JMC Any more suggestions would be greatly appreciated. JMC Justin JMC -Original Message- JMC From: CodersNightMare [mailto:[EMAIL PROTECTED] JMC Sent: Friday, February 28, 2003 10:32 AM JMC To: [EMAIL PROTECTED] JMC Subject: RE: [PHP] Can't run PHP cli script from Cron JMC I am sure you have tried this, but, JMC Do you call the full path to php for cron. JMC something like: JMC 40 * * * * /usr/local/bin/php -q /home/user/phpcliscript JMC Hope this helps. JMC At 10:10 AM 2/28/2003 -0800, you wrote: The path is #!/usr/local/bin/php -q But like I said, that can't be the problem because when I run it from the command line, it runs fine. The only problem I am having is that JMC it won't run from cron. That is why I think it is an issue with the cron environment. All other types of scripts like bash scripts run fine JMC from cron. I am surprised no one else has come across this problem before. Please help me! Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: R'twick Niceorgaw [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 9:44 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can't run PHP cli script from Cron Shouldn't it be #!/usr/local/bin/php Or was it just a typo here? - Original Message - From: Justin Michael Couto [EMAIL PROTECTED] To: 'Ernest E Vogelsinger' [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:09 PM Subject: RE: [PHP] Can't run PHP cli script from Cron I can run it from the shell prompt perfectly fine. I just won't JMC run from cron. I do have the statement: #!/usr/local/php In the beginning of my script. Like I said it works perfect when I run it by hand from the shell prompt. I think the reason it is not running has to do with the cron environment, but I am not ssure what it is. Justin Michael Couto[EMAIL PROTECTED] Director of Operations 805.781.0420 Somnio World Web Solutions http://www.somnioworld.com -Original Message- From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED] Sent: Friday, February 28, 2003 12:55 AM To: Justin Michael Couto Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can't run PHP cli script from Cron At