Reply to Re: a PHP script works fine when called from the browser but not as a shell script

Your name:

Reply:


Posted by Rich on 12/21/05 21:13

In article <cr4jq11m9sosrfj8ueolirlpma4dnvpm20@4ax.com>, Andy Hassall says...
>
>On 21 Dec 2005 09:06:53 -0800, "lawrence k" <lkrubner@geocities.com> wrote:
>
>>I've got a script called makeRss.php. It works fine if I try to open it
>>with my browser. It makes an RSS feed for every page on my site. You
>>can see it working here:
>>
>>http://www.autostratus.com/index.php?whatPage=makeRss
>>
>>It does just what I want it to do.
>>
>>However, I need for this script to get called every 15 minutes. So I
>>set it up as a cron job. And cron doesn't like calling this thing. Cron
>>is nice enough to send me an email with an error message. Every 15
>>minutes I get this:
>>
>>/home/httpd/vhosts/autostratus.com/httpdocs/makeRss.php: line 1: ?php:
>>No such fil
>
> You seem to be trying to run the .php file directly. This won't work; you
>either need a #! line at the beginning, or you need to run it via PHP.
>
> So either:
>
>#!/path/to/php
>
> as the first line, which will mess things up when it's run via the web, or
>change your cron entry to:
>
>*/15 * * * * /path/to/php /path/to/makeRss.php
>
> ... as I'm assuming it's currently something like:
>
>*/15 * * * * /path/to/makeRss.php
>

Thanks for the information Andy. I had gotten so use to using PHP in web page
specific applications, I've never tried running it as a shell command. Pretty
straight forward and offers some options I can use on future PHP projects.

Rich
--
Newsguy - http://newsguy.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация