[PHP] Running PHP as a cron job....
Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Running PHP as a cron job....
How are you executing the script? Does it come by and run 'php yourscript.php' or does the script have a shebang ('#!/usr/bin/php') in it? I've found that works well... just put that as the first line, and it behaves as a shell script (after you make it executable, of course) Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Running PHP as a cron job Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Running PHP as a cron job....
Hi Ben, When running it as a normal PHP file, I get the cron daemon emailing me stuff like: automation/mail.php: ?: No such file or directory automation/mail.php: =: command not found automation/mail.php: =: command not found automation/mail.php: line 7: syntax error near unexpected token `mail(emailaddress@takenout,' automation/mail.php: line 7: `mail(emailaddress@takenout, mail test, $mailcontent, $sender);' When running it with the Perl style line at the top (as you suggested) I get, no such file or directory. The script is Chmodded to 755 in both cases. And I saved it as a .php and .cgi file (with the root to bin/php in it). God knows what I'm doing wrong ;) James. How are you executing the script? Does it come by and run 'php yourscript.php' or does the script have a shebang ('#!/usr/bin/php') in it? I've found that works well... just put that as the first line, and it behaves as a shell script (after you make it executable, of course) Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Running PHP as a cron job Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Running PHP as a cron job....
Make sure the code is like: #!/usr/local/bin/php -q ?php ...code... ? (obviously the location of php may be different, but the above works for me, I'm running a daily e-mail batch from a PHP script via cron) Make sure you chmod ug+x it. -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 6:57 PM To: Ben Bleything; [EMAIL PROTECTED] Subject: Re: [PHP] Running PHP as a cron job Hi Ben, When running it as a normal PHP file, I get the cron daemon emailing me stuff like: automation/mail.php: ?: No such file or directory automation/mail.php: =: command not found automation/mail.php: =: command not found automation/mail.php: line 7: syntax error near unexpected token `mail(emailaddress@takenout,' automation/mail.php: line 7: `mail(emailaddress@takenout, mail test, $mailcontent, $sender);' When running it with the Perl style line at the top (as you suggested) I get, no such file or directory. The script is Chmodded to 755 in both cases. And I saved it as a .php and .cgi file (with the root to bin/php in it). God knows what I'm doing wrong ;) James. How are you executing the script? Does it come by and run 'php yourscript.php' or does the script have a shebang ('#!/usr/bin/php') in it? I've found that works well... just put that as the first line, and it behaves as a shell script (after you make it executable, of course) Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Running PHP as a cron job Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Running PHP as a cron job....
Otay... So, to get the shebang right, you need to know the path to the php binary... it may not be where I said it was... You probably already figured that out. You will also need to set it executable. It looks, from what you sent, that crond is interpreting the php file (and not having much luck) So... I'm not extremely familiar with cron, so, let me guess a little... in your /etc/cron.hourly (or whatever) directory, you've got this script, right? My guess would be, if you 'chmod +x file' on this, with the shebang (with proper path) it will work. Let me know, Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:57 PM To: Ben Bleything; [EMAIL PROTECTED] Subject: Re: [PHP] Running PHP as a cron job Hi Ben, When running it as a normal PHP file, I get the cron daemon emailing me stuff like: automation/mail.php: ?: No such file or directory automation/mail.php: =: command not found automation/mail.php: =: command not found automation/mail.php: line 7: syntax error near unexpected token `mail(emailaddress@takenout,' automation/mail.php: line 7: `mail(emailaddress@takenout, mail test, $mailcontent, $sender);' When running it with the Perl style line at the top (as you suggested) I get, no such file or directory. The script is Chmodded to 755 in both cases. And I saved it as a .php and .cgi file (with the root to bin/php in it). God knows what I'm doing wrong ;) James. How are you executing the script? Does it come by and run 'php yourscript.php' or does the script have a shebang ('#!/usr/bin/php') in it? I've found that works well... just put that as the first line, and it behaves as a shell script (after you make it executable, of course) Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Running PHP as a cron job Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Running PHP as a cron job....
On 08-Jul-01 James, Yz wrote: Hi Ben, When running it as a normal PHP file, I get the cron daemon emailing me stuff like: automation/mail.php: ?: No such file or directory automation/mail.php: =: command not found automation/mail.php: =: command not found automation/mail.php: line 7: syntax error near unexpected token `mail(emailaddress@takenout,' automation/mail.php: line 7: `mail(emailaddress@takenout, mail test, $mailcontent, $sender);' try a wrapper When running it with the Perl style line at the top (as you suggested) I get, no such file or directory. The script is Chmodded to 755 in both cases. And I saved it as a .php and .cgi file (with the root to bin/php in it). God knows what I'm doing wrong ;) James. How are you executing the script? Does it come by and run 'php yourscript.php' or does the script have a shebang ('#!/usr/bin/php') in it? I've found that works well... just put that as the first line, and it behaves as a shell script (after you make it executable, of course) Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Running PHP as a cron job Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Running PHP as a cron job....
Check the path to your php cgi executable - which php - you'll probably find that it's #!/usr/local/bin/php This is what the no such file or directory is referring to. Chris Don Read wrote: On 08-Jul-01 James, Yz wrote: Hi Ben, When running it as a normal PHP file, I get the cron daemon emailing me stuff like: automation/mail.php: ?: No such file or directory automation/mail.php: =: command not found automation/mail.php: =: command not found automation/mail.php: line 7: syntax error near unexpected token `mail(emailaddress@takenout,' automation/mail.php: line 7: `mail(emailaddress@takenout, mail test, $mailcontent, $sender);' try a wrapper When running it with the Perl style line at the top (as you suggested) I get, no such file or directory. The script is Chmodded to 755 in both cases. And I saved it as a .php and .cgi file (with the root to bin/php in it). God knows what I'm doing wrong ;) James. How are you executing the script? Does it come by and run 'php yourscript.php' or does the script have a shebang ('#!/usr/bin/php') in it? I've found that works well... just put that as the first line, and it behaves as a shell script (after you make it executable, of course) Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Running PHP as a cron job Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Running PHP as a cron job....
This looks like a good place for me to step in and maybe clear up something I've been wondering about ... With all the advice that has been offered so far, has it been assumed that php is installed in the CGI rather than DSO manner? Can PHP as a DSO interpret shell script-like files with a shebang at the top? Alternatively, I've read somewhere about using lynx to run a .php cron job. Does this apply to DSO setups? For example, would James put something like this in his crontab: * * * * lynx mail.php TIA Mick On Mon, 9 Jul 2001, Chris Fry wrote: Check the path to your php cgi executable - which php - you'll probably find that it's #!/usr/local/bin/php This is what the no such file or directory is referring to. Chris Don Read wrote: On 08-Jul-01 James, Yz wrote: Hi Ben, When running it as a normal PHP file, I get the cron daemon emailing me stuff like: automation/mail.php: ?: No such file or directory automation/mail.php: =: command not found automation/mail.php: =: command not found automation/mail.php: line 7: syntax error near unexpected token `mail(emailaddress@takenout,' automation/mail.php: line 7: `mail(emailaddress@takenout, mail test, $mailcontent, $sender);' try a wrapper When running it with the Perl style line at the top (as you suggested) I get, no such file or directory. The script is Chmodded to 755 in both cases. And I saved it as a .php and .cgi file (with the root to bin/php in it). God knows what I'm doing wrong ;) James. How are you executing the script? Does it come by and run 'php yourscript.php' or does the script have a shebang ('#!/usr/bin/php') in it? I've found that works well... just put that as the first line, and it behaves as a shell script (after you make it executable, of course) Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Running PHP as a cron job Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP
RE: [PHP] Running PHP as a cron job....
Interesting method, with the lynx... I imagine that if you've only built the DSO, then that would be the way to do it.. if it worked. My guess would be, you would have to do lynx 'http://localhost/path/to/script/script.php' to force it to go through the server. TO be totally honest with you, I'm too lazy to learn bash scripting, so I've been using php (it's fast and easy and does everything I need! Honest!) so when I build a new version of php, I make both... =P ANYWAY, thanks for clarifying... I think we all had been assuming = Ben -Original Message- From: Michael Hall [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:16 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Running PHP as a cron job This looks like a good place for me to step in and maybe clear up something I've been wondering about ... With all the advice that has been offered so far, has it been assumed that php is installed in the CGI rather than DSO manner? Can PHP as a DSO interpret shell script-like files with a shebang at the top? Alternatively, I've read somewhere about using lynx to run a .php cron job. Does this apply to DSO setups? For example, would James put something like this in his crontab: * * * * lynx mail.php TIA Mick On Mon, 9 Jul 2001, Chris Fry wrote: Check the path to your php cgi executable - which php - you'll probably find that it's #!/usr/local/bin/php This is what the no such file or directory is referring to. Chris Don Read wrote: On 08-Jul-01 James, Yz wrote: Hi Ben, When running it as a normal PHP file, I get the cron daemon emailing me stuff like: automation/mail.php: ?: No such file or directory automation/mail.php: =: command not found automation/mail.php: =: command not found automation/mail.php: line 7: syntax error near unexpected token `mail(emailaddress@takenout,' automation/mail.php: line 7: `mail(emailaddress@takenout, mail test, $mailcontent, $sender);' try a wrapper When running it with the Perl style line at the top (as you suggested) I get, no such file or directory. The script is Chmodded to 755 in both cases. And I saved it as a .php and .cgi file (with the root to bin/php in it). God knows what I'm doing wrong ;) James. How are you executing the script? Does it come by and run 'php yourscript.php' or does the script have a shebang ('#!/usr/bin/php') in it? I've found that works well... just put that as the first line, and it behaves as a shell script (after you make it executable, of course) Ben -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Running PHP as a cron job Hi all, This is probably going to sound incoherant, but Do I have to do anything (other than change the permissions of a php file) to get it to run as part of a cron job? I created an extremely simple file that should just send a blank email to me (using mail()). I got an email from the cron daemon saying, bad token, or something like that, yet when executed through a browser, the script behaves as it should. Do I have to write the php scripts differently to how I would if they were to be displayed in a browser? Neeed...Slp ;) Cheers, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you
RE: [PHP] Running PHP as a cron job....
On Sun, 8 Jul 2001, Ben Bleything wrote: Interesting method, with the lynx... I imagine that if you've only built the DSO, then that would be the way to do it.. if it worked. My guess would be, you would have to do lynx 'http://localhost/path/to/script/script.php' to force it to go through the server. Yes, I was a bit lazy with my example, you would certainly need to include a proper URL. Apart from that though, a script called in this manner should output whatever it is supposed to, whether a text file or an email or whatever. TO be totally honest with you, I'm too lazy to learn bash scripting, so I've been using php (it's fast and easy and does everything I need! Honest!) so when I build a new version of php, I make both... =P I've just recently got a bit more serious with learning bash scripting and am surprised at how powerful it really is, in conjunction with the usual UNIX commands and other tools. PHP is the only choice for most things web related, but I'm finding that bash is making my server admin tasks easier and quicker. In fact, I'm currently working on a PHP code snippet manager written in bash! If the idea has any legs, I might convert it over to Python or something later ... Anyway, Mick. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Running PHP as a cron job....
Michael Hall [EMAIL PROTECTED] wrote: With all the advice that has been offered so far, has it been assumed that php is installed in the CGI rather than DSO manner? I haven't found this to be clear from the thread. Can PHP as a DSO interpret shell script-like files with a shebang at the top? No. This only works if PHP is compiled in stand-alone (CGI) mode. Alternatively, I've read somewhere about using lynx to run a .php cron job. Does this apply to DSO setups? For example, would James put something like this in his crontab: * * * * lynx mail.php Almost. Instead of the filename, the *full* URL is needed. If PHP is compiled as an Apache DSO the only way Apache can parse the PHP script is if the file is accessed via the webserver, not directly off of the filesystem. If anyone goes this route I strongly suggest adding authentication via an .htaccess file and passing the user/pwd to lynx (see man lynx) so that your script which is probably only intended to be run via cron isn't available for anyone on the web to access. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Running PHP as a cron job....
Ben Bleything [EMAIL PROTECTED] wrote: Interesting method, with the lynx... I imagine that if you've only built the DSO, then that would be the way to do it.. if it worked. It works. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Running PHP as a cron job....
Michael Hall [EMAIL PROTECTED] wrote: I've just recently got a bit more serious with learning bash scripting and am surprised at how powerful it really is, in conjunction with the usual UNIX commands and other tools. PHP is the only choice for most things web related, but I'm finding that bash is making my server admin tasks easier and quicker. In fact, I'm currently working on a PHP code snippet manager written in bash! If the idea has any legs, I might convert it over to Python or something later ... Hmm. A PHP code snippet manager written in bash, possibly to be converted to Python...but no mention of converting to PHP. Are you planning a Java code snippet manager written in Fortran? Just kidding. Definitely reminds you that there are a lot of tools that can be used for any given job and lots of solutions for every problem. BTW, I split my shell scripting between bash and PHP, used to do shell scripting in Perl, but I rarely use it anymore so I'm much faster scripting in PHP. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]