what does the error " bad interpreter" mean? | | |
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. | | | | 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 | | | | 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$ | | | | 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. | | | | 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! | | | | 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 | | | | 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? | | | | 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
================== | | | | 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. | | | | 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? | | | | 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:/$ | | | | 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". | | | | 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
================== | | | | 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
================== | | | | 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
================== | | | | 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. | | | | 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. |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,510 network members.
|