473,503 Members | 3,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.

Feb 9 '08 #1
16 9190
lawrence k schreef:
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
Feb 9 '08 #2
On Feb 9, 3:26 pm, Luuk <L...@invalid.lanwrote:
lawrence k schreef:
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'

What I get:

lkrubner@programmerpc3:/usr/share$ whereis php
php:
lkrubner@programmerpc3:/usr/share$
Feb 9 '08 #3
On Feb 9, 3:26 pm, Luuk <L...@invalid.lanwrote:
lawrence k schreef:
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'

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.

Feb 9 '08 #4
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!
Feb 9 '08 #5
On Feb 9, 6:23 pm, Dikkie Dik <dik...@nospam.orgwrote:
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

Feb 9 '08 #6
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?

Feb 9 '08 #7
lawrence k wrote:
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.

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

Feb 10 '08 #8
lawrence k <lk******@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.
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, ti**@probo.com
Providenza & Boekelheide, Inc.
Feb 10 '08 #9
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
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.

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?

Feb 10 '08 #10
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
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.

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:/$


Feb 10 '08 #11
On Feb 9, 9:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
lawrence k wrote:
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".
Feb 10 '08 #12
lawrence k wrote:
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
>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.
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.
js*******@attglobal.net
==================

Feb 10 '08 #13
lawrence k wrote:
On Feb 9, 9:21 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>lawrence k wrote:
>>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.
js*******@attglobal.net
==================

Feb 10 '08 #14
lawrence k wrote:
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
>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.
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.
js*******@attglobal.net
==================

Feb 10 '08 #15
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
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.

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.
Feb 10 '08 #16
On Feb 9, 7:19 pm, lawrence k <lkrub...@geocities.comwrote:
On Feb 9, 9:53 pm, Tim Roberts <t...@probo.comwrote:
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.
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.
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.
Feb 10 '08 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
6827
by: lkrubner | last post by:
I want to give users the power to edit files from an easy interface, so I create a form and a PHP script called "fileUpdate". It does a reasonable about of error checking and prints out some...
6
22877
by: allenj | last post by:
DB21085I Instance "md" uses "32" bits and DB2 code release "SQL08012" with level identifier "02030106". Informational tokens are "DB2 v8.1.0.16", "s030508", "MI00048", and FixPak "2". Product is...
9
4497
by: Marek Kurowski | last post by:
Yo! What mean when program is ALPHA or BETA version? I suppose it is not release version of program, but I don't know what it exactly mean. What it mean in your opinion? Marek Kurowski
3
5947
by: Dave | last post by:
Greetings All, I have never seen this error before, and after an extensive search of Groups, I cannot find a satisfactory answer to my basic question. What exactly does "is not a member of...
9
76468
by: plusk1008 | last post by:
I have finals next week and I am stuck on one question on my review sheet for excel. So once again I beg: Please, please, please, please, please, please, please, please, please, please someone help...
4
3701
by: chandanlinster | last post by:
hello everybody, as i was going through the "printf" man page, i came across this statement. printf("%*d", width, num); what does "*" mean?
4
10803
by: david.karr | last post by:
I'm a CSS newbie, but I was browsing through the css files in the YUI library, and I noticed the following line: body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-...
0
1966
by: Gabriel Genellina | last post by:
En Thu, 25 Sep 2008 09:49:31 -0300, Almar Klein <almar.klein@gmail.com> escribió: Use subprocess.PIPE Usually the tricky part is to figure out exactly whether there is more input or not. With...
9
27604
by: erictheone | last post by:
Ok so what I'm trying to do is create a trans location cipher. For those among us that don't know alot about cryptography it is a method for jumbling up letters to disguise linguistic...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7445
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.