what does the error " bad interpreter" mean?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence k

    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@progra mmerpc3:/$ /home/lkrubner/cron_jobs/
    dailyBackupSpac eBunny.php

    bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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

    #2
    Re: what does the error &quot; bad interpreter&quo t; mean?

    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@progra mmerpc3:/$ /home/lkrubner/cron_jobs/
    dailyBackupSpac eBunny.php
    >
    bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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

    Comment

    • lawrence k

      #3
      Re: what does the error &quot; bad interpreter&quo t; mean?

      On Feb 9, 3:26 pm, Luuk <L...@invalid.l anwrote:
      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@progra mmerpc3:/$ /home/lkrubner/cron_jobs/
      dailyBackupSpac eBunny.php
      >
      bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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@progra mmerpc3:/usr/share$ whereis php
      php:
      lkrubner@progra mmerpc3:/usr/share$


      Comment

      • lawrence k

        #4
        Re: what does the error &quot; bad interpreter&quo t; mean?

        On Feb 9, 3:26 pm, Luuk <L...@invalid.l anwrote:
        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@progra mmerpc3:/$ /home/lkrubner/cron_jobs/
        dailyBackupSpac eBunny.php
        >
        bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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.

        Comment

        • Dikkie Dik

          #5
          Re: what does the error &quot; bad interpreter&quo t; 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!

          Comment

          • lawrence k

            #6
            Re: what does the error &quot; bad interpreter&quo t; mean?

            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@progra mmerpc3:/usr/share$ /home/lkrubner/cron_jobs/
            dailyBackupSpac eBunny.php

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





            Comment

            • lawrence k

              #7
              Re: what does the error &quot; bad interpreter&quo t; mean?

              On Feb 9, 3:05 pm, lawrence k <lkrub...@geoci ties.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@progra mmerpc3:/$ /home/lkrubner/cron_jobs/
              dailyBackupSpac eBunny.php
              >
              bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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?

              Comment

              • Jerry Stuckle

                #8
                Re: what does the error &quot; bad interpreter&quo t; mean?

                lawrence k wrote:
                On Feb 9, 3:05 pm, lawrence k <lkrub...@geoci ties.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@progr ammerpc3:/$ /home/lkrubner/cron_jobs/
                >dailyBackupSpa ceBunny.php
                >>
                >bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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@attgl obal.net
                =============== ===

                Comment

                • Tim Roberts

                  #9
                  Re: what does the error &quot; bad interpreter&quo t; mean?

                  lawrence k <lkrubner@geoci ties.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@progr ammerpc3:/$ /home/lkrubner/cron_jobs/
                  >dailyBackupSpa ceBunny.php
                  >
                  >bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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.

                  Comment

                  • lawrence k

                    #10
                    Re: what does the error &quot; bad interpreter&quo t; mean?

                    On Feb 9, 9:53 pm, Tim Roberts <t...@probo.com wrote:
                    lawrence k <lkrub...@geoci ties.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@progra mmerpc3:/$ /home/lkrubner/cron_jobs/
                    dailyBackupSpac eBunny.php
                    >
                    bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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@progra mmerpc3:/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?



                    Comment

                    • lawrence k

                      #11
                      Re: what does the error &quot; bad interpreter&quo t; mean?

                      On Feb 9, 9:53 pm, Tim Roberts <t...@probo.com wrote:
                      lawrence k <lkrub...@geoci ties.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@progra mmerpc3:/$ /home/lkrubner/cron_jobs/
                      dailyBackupSpac eBunny.php
                      >
                      bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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@progra mmerpc3:/usr/share/php5$ /home/lkrubner/cron_jobs/
                      dailyBackupSpac eBunny.php

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


                      and when I run whereis, I get nothing:

                      lkrubner@progra mmerpc3:/$ whereis php
                      php:
                      lkrubner@progra mmerpc3:/$




                      Comment

                      • lawrence k

                        #12
                        Re: what does the error &quot; bad interpreter&quo t; mean?

                        On Feb 9, 9:21 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                        lawrence k wrote:
                        On Feb 9, 3:05 pm, lawrence k <lkrub...@geoci ties.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@progra mmerpc3:/$ /home/lkrubner/cron_jobs/
                        dailyBackupSpac eBunny.php
                        >
                        bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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".


                        Comment

                        • Jerry Stuckle

                          #13
                          Re: what does the error &quot; bad interpreter&quo t; mean?

                          lawrence k wrote:
                          On Feb 9, 9:53 pm, Tim Roberts <t...@probo.com wrote:
                          >lawrence k <lkrub...@geoci ties.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@prog rammerpc3:/$ /home/lkrubner/cron_jobs/
                          >>dailyBackupSp aceBunny.php
                          >>bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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@progra mmerpc3:/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@attgl obal.net
                          =============== ===

                          Comment

                          • Jerry Stuckle

                            #14
                            Re: what does the error &quot; bad interpreter&quo t; mean?

                            lawrence k wrote:
                            On Feb 9, 9:21 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                            >lawrence k wrote:
                            >>On Feb 9, 3:05 pm, lawrence k <lkrub...@geoci ties.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
                            >>>interperte r" error:
                            >>>lkrubner@pro grammerpc3:/$ /home/lkrubner/cron_jobs/
                            >>>dailyBackupS paceBunny.php
                            >>>bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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@attgl obal.net
                            =============== ===

                            Comment

                            • Jerry Stuckle

                              #15
                              Re: what does the error &quot; bad interpreter&quo t; mean?

                              lawrence k wrote:
                              On Feb 9, 9:53 pm, Tim Roberts <t...@probo.com wrote:
                              >lawrence k <lkrub...@geoci ties.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@prog rammerpc3:/$ /home/lkrubner/cron_jobs/
                              >>dailyBackupSp aceBunny.php
                              >>bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.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@progra mmerpc3:/usr/share/php5$ /home/lkrubner/cron_jobs/
                              dailyBackupSpac eBunny.php
                              >
                              bash: /home/lkrubner/cron_jobs/dailyBackupSpac eBunny.php: /usr/share/
                              php5/php.ini-dist: bad interpreter: Permission denied
                              >
                              >
                              and when I run whereis, I get nothing:
                              >
                              lkrubner@progra mmerpc3:/$ whereis php
                              php:
                              lkrubner@progra mmerpc3:/$
                              >
                              >
                              >
                              >
                              >
                              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@attgl obal.net
                              =============== ===

                              Comment

                              Working...