| 
	
 | 
 Posted by Lars Eighner on 12/22/05 03:02 
In our last episode, 
<1135207950.627575.190780@g49g2000cwa.googlegroups.com>, the 
lovely and talented lawrence k broadcast on comp.lang.php: 
 
 
> Andy Hassall wrote: 
>> On 21 Dec 2005 09:06:53 -0800, "lawrence k" <lkrubner@geocities.com> wrote: 
>> 
>> > 
>> >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 
 
> I ran phpinfo() to find out the path, and this is the info I got: 
 
> PATH 	/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin 
 
> _SERVER["PATH"]	/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin 
 
> _SERVER["PATH_TRANSLATED"]	/home/httpd/vhosts/autostratus.com/httpdocs/info.php 
 
> _ENV["PATH"]	/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin 
 
 
> I'm sorry I know so little about shell scripts, but I can't figure from 
> this what the address in the first line should be. Is it like this: 
 
> #!/sbin/php 
 
run 
which php 
 
That returns (in FreeBSD, will almost certainly vary in other 
unices): 
 
/usr/local/bin/php 
 
That's what goes in the she-bang line: 
#!/usr/local/bin/php 
 
("She-bang" is an informal expression for #!). 
 
This works for many kinds of scripts etc. in other languages, 
such as perl, various shells, etc. 
 
However, others have pointed out, php is not entirely unbroken 
in this regard, and it would be more convenient for you if you 
only had one version of each script, so the better option for 
you is to run php from chron with your script as an argument. 
 
--  
Lars Eighner         usenet@larseighner.com         http://www.larseighner.com/ 
Good Morning, Carnivore! - Anthrax botulin nuclear flight mail Akbar reservoir  
Ramadan letter activate bridge Abdul safehouse virgins money detonators Allah 
  smallpox Glaspie Springfield agent airport dispersal facility counterfeit
 
[Back to original message] 
 |