You are here: Re: a PHP script works fine when called from the browser but not as a shell script « PHP Programming Language « IT news, forums, messages
Re: a PHP script works fine when called from the browser but not as a shell script

Posted by Lars Eighner on 12/21/05 21:33

In our last episode,
<1135184813.363991.89850@g49g2000cwa.googlegroups.com>,
the lovely and talented lawrence k
broadcast on comp.lang.php:

> /home/httpd/vhosts/autostratus.com/httpdocs/makeRss.php: line 1: ?php:
> No such file
> or directory
> /home/httpd/vhosts/autostratus.com/httpdocs/makeRss.php: line 2: syntax
> error near
> unexpected token `"tagIndexLibrary.php"'
> /home/httpd/vhosts/autostratus.com/httpdocs/makeRss.php: line 2:
> `include_once("tagIndexLibrary.php");


> Why would cron have a problem if the script works fine from the web
> browser?

The executable is php, not your php script. The server knows
this. The operating system does not.

The first two characters of your file need to be #! followed
immediately by the path to php (not makeRss.php) - and when I
say first two characters, I mean the first two characters with
no preceding empty lines or spaces. Or you can call php from
chron with your script as an argument.

--
Lars Eighner usenet@larseighner.com http://www.larseighner.com/
My mail reader can beat up your mail reader.

 

Navigation:

[Reply to this 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

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