RE: [PHP] #!/usr/bin/php appears in the output
| From: | Darren Gamble | Date: | Wed, 07 Aug 2002 16:42:21 +0000 |
| Subject: | RE: [PHP] #!/usr/bin/php appears in the output | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111534@lists.php.net to get a copy of this message | ||
Good day,
> When you are running scripts in the cgi-bin directory of a
> web server (set
> up so that they run as each user) then you start them with the line:
>
> #!/usr/bin/php
>
> but when the script is run with:
>
> http://www.myuser.myserver.com/cgi-bin/script.php
>
> then the first line sent back to the browser is #!/usr/bin/perl
>
> How do you prevent that happening?
I don't believe there is any way to do this.
On the command line, the first line needs to tell the shell what the
interpreter is.
When running from the web server, the first line needs to tell the PHP
interpreter to start parsing (or it will just dump the output as text).
You could forgo the #! and just call the script by running /usr/bin/php when
on the command line. That's the only thing I can think of that will work
for sure.
Maybe you could get something to work by having "# <?php" as your first line
(the shell will ignore it as a comment but the interpreter running in the
web server will not).
============================
Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948