[ciapug] php interpreter errors

David Champion ciapug@cialug.org
Mon, 12 Apr 2004 15:40:47 -0500


Ryan O'Rourke wrote:

>On Mon, 2004-04-12 at 14:58, David Champion wrote:   
>  
>
>>>>>When trying to run the following php script from the command line, why
>>>>>does it work when I do:
>>>>>	php test.php
>>>>>but not when I do:
>>>>>	./test.php
>>>>>??
>>>>>
>>>>>#!/usr/local/bin/php
>>>>><?php
>>>>>$test =  "testing - testing";
>>>>>echo $test;
>>>>>?>
>>>>>
>>>>>
>>>>>The error I get is ": bad interpreter: No such file or directory"
>>>>>          
>>>>>
>>>>At the command prompt, type "which php"... it will show you if it's in 
>>>>your path. Also look at ls -l /usr/local/bin/php - could be that it 
>>>>doesn't exist.
>>>>   
>>>>        
>>>>
>>># which php
>>>/usr/local/bin/php
>>># ls /usr/local/bin/php
>>>/usr/local/bin/php
>>> 
>>>
>>>      
>>>
>>do "ls -l". That will show the permissions, size, and if it's a broken 
>>symbollic link or anything like that.
>>    
>>
>
>$ ls -l /usr/local/bin/php
>-rwxr-xr-x    1 root     root      6556398 Feb  4 15:04
>/usr/local/bin/php
>$ php -v
>PHP 4.3.0 (cli) (built: Apr 29 2003 12:42:21)
>Copyright (c) 1997-2002 The PHP Group
>Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
>
>  
>
Not sure what to tell you... that all looks right. When I test it, if I 
change my "#!/usr/bin/php" (my path is different...) to 
"#!/usr/bin/phpnot", I also get the bad interpreter message.

The size of that file is maybe not good... mine is 19,196 bytes 
(granted, it's on a different system - Mandrake - and a different 
version - 4.3.3). PHP has had several updates, IIRC 4.3.0 has some 
vulnerabilities. You might try doing an update... maybe it will fix itself?

-dc