Connecting Tech Pros Worldwide Forums | Help | Site Map

what does the error " bad interpreter" mean?

lawrence k
Guest
 
Posts: n/a
#1: Feb 9 '08

I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:

#!/usr/share/php5
<?php
echo "hello";
?>


In a terminal window, I try to execute this, and I get a "bad
interperter" error:

lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php

bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied


What does that mean?

The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.




Luuk
Guest
 
Posts: n/a
#2: Feb 9 '08

re: what does the error " bad interpreter" mean?


lawrence k schreef:
Quote:
I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:
>
#!/usr/share/php5
<?php
echo "hello";
?>
>
>
In a terminal window, I try to execute this, and I get a "bad
interperter" error:
>
lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied
>
>
What does that mean?
>
The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.
>
>
>
it means you got the wrong interpreter
try:
$ whereis php
php: /usr/bin/php

then replace '/usr/share/php5' with '/usr/bin/php'


--
Luuk
lawrence k
Guest
 
Posts: n/a
#3: Feb 9 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 3:26 pm, Luuk <L...@invalid.lanwrote:
Quote:
lawrence k schreef:
>
>
>
Quote:
I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:
>
Quote:
#!/usr/share/php5
<?php
echo "hello";
?>
>
Quote:
In a terminal window, I try to execute this, and I get a "bad
interperter" error:
>
Quote:
lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
Quote:
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied
>
Quote:
What does that mean?
>
Quote:
The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.
>
it means you got the wrong interpreter
try:
$ whereis php
php: /usr/bin/php
>
then replace '/usr/share/php5' with '/usr/bin/php'

What I get:

lkrubner@programmerpc3:/usr/share$ whereis php
php:
lkrubner@programmerpc3:/usr/share$


lawrence k
Guest
 
Posts: n/a
#4: Feb 9 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 3:26 pm, Luuk <L...@invalid.lanwrote:
Quote:
lawrence k schreef:
>
>
>
Quote:
I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:
>
Quote:
#!/usr/share/php5
<?php
echo "hello";
?>
>
Quote:
In a terminal window, I try to execute this, and I get a "bad
interperter" error:
>
Quote:
lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
Quote:
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied
>
Quote:
What does that mean?
>
Quote:
The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.
>
it means you got the wrong interpreter
try:
$ whereis php
php: /usr/bin/php
>
then replace '/usr/share/php5' with '/usr/bin/php'

The Synaptic Package Manager also tells me that php5 is in /usr/share/

Mind you, my machine didn't have PHP installed till today. I just used
the Synaptic Package Manager to install it.

Dikkie Dik
Guest
 
Posts: n/a
#5: Feb 9 '08

re: what does the error " bad interpreter" mean?


The Synaptic Package Manager also tells me that php5 is in /usr/share/

Strange. My Xubuntu machine just has it on /usr/bin/php. Did you try to
set the first line to
#!/usr/bin/php
?

Good luck!
lawrence k
Guest
 
Posts: n/a
#6: Feb 9 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 6:23 pm, Dikkie Dik <dik...@nospam.orgwrote:
Quote:
Quote:
The Synaptic Package Manager also tells me that php5 is in /usr/share/
>
Strange. My Xubuntu machine just has it on /usr/bin/php. Did you try to
set the first line to
#!/usr/bin/php
Doesn't seem possible that would work if both whereis and the Synaptic
Package Manager are suggesting a different address, but just for the
hell of it, I gave it a try. No dice:


lkrubner@programmerpc3:/usr/share$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php

bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/bin/
php: bad interpreter: No such file or directory





lawrence k
Guest
 
Posts: n/a
#7: Feb 9 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 3:05 pm, lawrence k <lkrub...@geocities.comwrote:
Quote:
I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:
>
#!/usr/share/php5
<?php
echo "hello";
?>
>
In a terminal window, I try to execute this, and I get a "bad
interperter" error:
>
lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied
>
What does that mean?
>
The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.
Is there just one interpreter? Do shell scripts use the same
interpreter as what runs through an Apace server?

Jerry Stuckle
Guest
 
Posts: n/a
#8: Feb 10 '08

re: what does the error " bad interpreter" mean?


lawrence k wrote:
Quote:
On Feb 9, 3:05 pm, lawrence k <lkrub...@geocities.comwrote:
Quote:
>I've never before written a PHP script to run on my home Ubuntu
>machine (though I've written dozens of PHP cron jobs for my web
>server), so I thought I'd start off with a very simple test:
>>
>#!/usr/share/php5
><?php
>echo "hello";
>?>
>>
>In a terminal window, I try to execute this, and I get a "bad
>interperter" error:
>>
>lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
>dailyBackupSpaceBunny.php
>>
>bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
>php5: bad interpreter: Permission denied
>>
>What does that mean?
>>
>The php5 interpreter in /usr/share/ has permissions set to 755. Any
>script on the machine should be able to execute.
>
Is there just one interpreter? Do shell scripts use the same
interpreter as what runs through an Apace server?
>
>
No. Shell scripts are not PHP, and do not use the PHP interpreter.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Tim Roberts
Guest
 
Posts: n/a
#9: Feb 10 '08

re: what does the error " bad interpreter" mean?


lawrence k <lkrubner@geocities.comwrote:
Quote:
>
>I've never before written a PHP script to run on my home Ubuntu
>machine (though I've written dozens of PHP cron jobs for my web
>server), so I thought I'd start off with a very simple test:
>
>#!/usr/share/php5
><?php
>echo "hello";
>?>
>
>In a terminal window, I try to execute this, and I get a "bad
>interperter" error:
>
>lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
>dailyBackupSpaceBunny.php
>
>bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
>php5: bad interpreter: Permission denied
>
>What does that mean?
>
>The php5 interpreter in /usr/share/ has permissions set to 755. Any
>script on the machine should be able to execute.
Are you sure php5 is the executable for the interpreter, and not the
directory that contains the interpreter? What does this tell you?

ls -l /usr/share/php5
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
lawrence k
Guest
 
Posts: n/a
#10: Feb 10 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
Quote:
lawrence k <lkrub...@geocities.comwrote:
>
Quote:
I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:
>
Quote:
#!/usr/share/php5
<?php
echo "hello";
?>
>
Quote:
In a terminal window, I try to execute this, and I get a "bad
interperter" error:
>
Quote:
lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
Quote:
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied
>
Quote:
What does that mean?
>
Quote:
The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.
>
Are you sure php5 is the executable for the interpreter, and not the
directory that contains the interpreter? What does this tell you?
>
ls -l /usr/share/php5
Nice catch. I feel like an idiot:

lkrubner@programmerpc3:/usr/share/php5$ ls -al
total 52
drwxr-xr-x 2 root root 4096 2008-02-09 14:24 .
drwxr-xr-x 308 root root 8192 2008-02-09 14:24 ..
-rw-r--r-- 1 root root 40467 2007-11-28 17:33 php.ini-dist


But what the hell is php.ini-dist?



lawrence k
Guest
 
Posts: n/a
#11: Feb 10 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
Quote:
lawrence k <lkrub...@geocities.comwrote:
>
Quote:
I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:
>
Quote:
#!/usr/share/php5
<?php
echo "hello";
?>
>
Quote:
In a terminal window, I try to execute this, and I get a "bad
interperter" error:
>
Quote:
lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
Quote:
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied
>
Quote:
What does that mean?
>
Quote:
The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.
>
Are you sure php5 is the executable for the interpreter, and not the
directory that contains the interpreter? What does this tell you?
>
ls -l /usr/share/php5

If I change the script to this:

#!/usr/share/php5/php.ini-dist
<?php
echo "hello";
?>


I still get the same error:

lkrubner@programmerpc3:/usr/share/php5$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php

bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5/php.ini-dist: bad interpreter: Permission denied


and when I run whereis, I get nothing:

lkrubner@programmerpc3:/$ whereis php
php:
lkrubner@programmerpc3:/$




lawrence k
Guest
 
Posts: n/a
#12: Feb 10 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 9:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
lawrence k wrote:
Quote:
On Feb 9, 3:05 pm, lawrence k <lkrub...@geocities.comwrote:
Quote:
I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:
>
Quote:
Quote:
#!/usr/share/php5
<?php
echo "hello";
?>
>
Quote:
Quote:
In a terminal window, I try to execute this, and I get a "bad
interperter" error:
>
Quote:
Quote:
lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
Quote:
Quote:
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied
>
Quote:
Quote:
What does that mean?
>
Quote:
Quote:
The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.
>
Quote:
Is there just one interpreter? Do shell scripts use the same
interpreter as what runs through an Apace server?
>
No. Shell scripts are not PHP, and do not use the PHP interpreter.

I apologize for misuse of the phrase "shell script", when I meant "PHP
script run at the command line".


Jerry Stuckle
Guest
 
Posts: n/a
#13: Feb 10 '08

re: what does the error " bad interpreter" mean?


lawrence k wrote:
Quote:
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
Quote:
>lawrence k <lkrub...@geocities.comwrote:
>>
Quote:
>>I've never before written a PHP script to run on my home Ubuntu
>>machine (though I've written dozens of PHP cron jobs for my web
>>server), so I thought I'd start off with a very simple test:
>>#!/usr/share/php5
>><?php
>>echo "hello";
>>?>
>>In a terminal window, I try to execute this, and I get a "bad
>>interperter" error:
>>lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
>>dailyBackupSpaceBunny.php
>>bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
>>php5: bad interpreter: Permission denied
>>What does that mean?
>>The php5 interpreter in /usr/share/ has permissions set to 755. Any
>>script on the machine should be able to execute.
>Are you sure php5 is the executable for the interpreter, and not the
>directory that contains the interpreter? What does this tell you?
>>
> ls -l /usr/share/php5
>
Nice catch. I feel like an idiot:
>
lkrubner@programmerpc3:/usr/share/php5$ ls -al
total 52
drwxr-xr-x 2 root root 4096 2008-02-09 14:24 .
drwxr-xr-x 308 root root 8192 2008-02-09 14:24 ..
-rw-r--r-- 1 root root 40467 2007-11-28 17:33 php.ini-dist
>
>
But what the hell is php.ini-dist?
>
>
>
>
That is just a sample php.ini file. You need to find where your php
executable is located - typically it's name is just 'php' (or 'php.exe
on Windoze).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Jerry Stuckle
Guest
 
Posts: n/a
#14: Feb 10 '08

re: what does the error " bad interpreter" mean?


lawrence k wrote:
Quote:
On Feb 9, 9:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
>lawrence k wrote:
Quote:
>>On Feb 9, 3:05 pm, lawrence k <lkrub...@geocities.comwrote:
>>>I've never before written a PHP script to run on my home Ubuntu
>>>machine (though I've written dozens of PHP cron jobs for my web
>>>server), so I thought I'd start off with a very simple test:
>>>#!/usr/share/php5
>>><?php
>>>echo "hello";
>>>?>
>>>In a terminal window, I try to execute this, and I get a "bad
>>>interperter" error:
>>>lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
>>>dailyBackupSpaceBunny.php
>>>bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
>>>php5: bad interpreter: Permission denied
>>>What does that mean?
>>>The php5 interpreter in /usr/share/ has permissions set to 755. Any
>>>script on the machine should be able to execute.
>>Is there just one interpreter? Do shell scripts use the same
>>interpreter as what runs through an Apace server?
>No. Shell scripts are not PHP, and do not use the PHP interpreter.
>
>
I apologize for misuse of the phrase "shell script", when I meant "PHP
script run at the command line".
>
>
>
OK, now that we're more clear - no, typically the Apache version uses a
module (or, occasionally, a CGI executable) while the command line uses
a non-cgi executable (although the cgi executable can be used).


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Jerry Stuckle
Guest
 
Posts: n/a
#15: Feb 10 '08

re: what does the error " bad interpreter" mean?


lawrence k wrote:
Quote:
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
Quote:
>lawrence k <lkrub...@geocities.comwrote:
>>
Quote:
>>I've never before written a PHP script to run on my home Ubuntu
>>machine (though I've written dozens of PHP cron jobs for my web
>>server), so I thought I'd start off with a very simple test:
>>#!/usr/share/php5
>><?php
>>echo "hello";
>>?>
>>In a terminal window, I try to execute this, and I get a "bad
>>interperter" error:
>>lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
>>dailyBackupSpaceBunny.php
>>bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
>>php5: bad interpreter: Permission denied
>>What does that mean?
>>The php5 interpreter in /usr/share/ has permissions set to 755. Any
>>script on the machine should be able to execute.
>Are you sure php5 is the executable for the interpreter, and not the
>directory that contains the interpreter? What does this tell you?
>>
> ls -l /usr/share/php5
>
>
If I change the script to this:
>
#!/usr/share/php5/php.ini-dist
<?php
echo "hello";
?>
>
>
I still get the same error:
>
lkrubner@programmerpc3:/usr/share/php5$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5/php.ini-dist: bad interpreter: Permission denied
>
>
and when I run whereis, I get nothing:
>
lkrubner@programmerpc3:/$ whereis php
php:
lkrubner@programmerpc3:/$
>
>
>
>
>
That's just because it's a sample .ini file, as I said. It is not an
executable.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

lawrence k
Guest
 
Posts: n/a
#16: Feb 10 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
Quote:
lawrence k <lkrub...@geocities.comwrote:
>
Quote:
I've never before written a PHP script to run on my home Ubuntu
machine (though I've written dozens of PHP cron jobs for my web
server), so I thought I'd start off with a very simple test:
>
Quote:
#!/usr/share/php5
<?php
echo "hello";
?>
>
Quote:
In a terminal window, I try to execute this, and I get a "bad
interperter" error:
>
Quote:
lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
dailyBackupSpaceBunny.php
>
Quote:
bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
php5: bad interpreter: Permission denied
>
Quote:
What does that mean?
>
Quote:
The php5 interpreter in /usr/share/ has permissions set to 755. Any
script on the machine should be able to execute.
>
Are you sure php5 is the executable for the interpreter, and not the
directory that contains the interpreter? What does this tell you?
>
ls -l /usr/share/php5

Well, for anyone else working with Ubuntu, and downloading packages
through the Synaptic Package Manager, be aware that searching for
"PHP5" doesn't get you the command line version of PHP5. You need to
specifically ask for "PHP5-cli".

As others suggested, this gets installed at /usr/bin/php5.

I now changed my script to this:

#!/usr/bin/php5
<?php
echo "hello";
?>


and now it works.

Thanks to everyone for all the help.


Richard Levasseur
Guest
 
Posts: n/a
#17: Feb 10 '08

re: what does the error " bad interpreter" mean?


On Feb 9, 7:19 pm, lawrence k <lkrub...@geocities.comwrote:
Quote:
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
>
>
>
Quote:
lawrence k <lkrub...@geocities.comwrote:
>
Quote:
Quote:
>I've never before written a PHP script to run on my home Ubuntu
>machine (though I've written dozens of PHP cron jobs for my web
>server), so I thought I'd start off with a very simple test:
>
Quote:
Quote:
>#!/usr/share/php5
><?php
>echo "hello";
>?>
>
Quote:
Quote:
>In a terminal window, I try to execute this, and I get a "bad
>interperter" error:
>
Quote:
Quote:
>lkrubner@programmerpc3:/$ /home/lkrubner/cron_jobs/
>dailyBackupSpaceBunny.php
>
Quote:
Quote:
>bash: /home/lkrubner/cron_jobs/dailyBackupSpaceBunny.php: /usr/share/
>php5: bad interpreter: Permission denied
>
Quote:
Quote:
>What does that mean?
>
Quote:
Quote:
>The php5 interpreter in /usr/share/ has permissions set to 755. Any
>script on the machine should be able to execute.
>
Quote:
Are you sure php5 is the executable for the interpreter, and not the
directory that contains the interpreter? What does this tell you?
>
Quote:
ls -l /usr/share/php5
>
Well, for anyone else working with Ubuntu, and downloading packages
through the Synaptic Package Manager, be aware that searching for
"PHP5" doesn't get you the command line version of PHP5. You need to
specifically ask for "PHP5-cli".
>
As others suggested, this gets installed at /usr/bin/php5.
>
I now changed my script to this:
>
#!/usr/bin/php5
<?php
echo "hello";
?>
>
and now it works.
>
Thanks to everyone for all the help.
just fyi: the "bad interpreter" error can also occur if you wrote a
script on windows and tried to run it on linux. It doesn't like the
\r on that same line, apparently.
Closed Thread