Re: bad interpreter error from CLI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 13, 2009 at 10:10, Thodoris <tgol@xxxxxxxxxx> wrote:
> Hi gang,
>   I am trying to run a script from cli which goes like this:
>
> #!/usr/bin/php
> <?php
> passthru("printenv");
> ?>
>
> The error I get is this:
> /usr/bin/php^M: bad interpreter: Permission denied

    Note the ^M --- then use dos2unix from the command line on the
Linux box to fix the line endings on that file.  The ^M character is a
sure-fire sign of a Windows-saved file.

> the php binary is indeed in this location and when I run the same script
> like this:
> php -f test.php
>
> it works properly. I will have to mention that the executable flag is set in
> the file's permissions.
>
> Any ideas why is this happening?
>
> php -v gives me:
> PHP 5.1.6 (cli) (built: Nov 12 2008 11:22:34)
> Copyright (c) 1997-2006 The PHP Group
> Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

    The above should no doubt fix it, but in the event that it does
not, check the output from the following command line commands on your
Linux box:

        which php
        whereis php

    The first will tell you which PHP CLI binary is preferred by the
current $PATH settings, while the second will tell you where in $PATH
'php' is located.

-- 
</Daniel P. Brown>
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux