On Fri, 28 Nov 2003, Nicole Lallande wrote:
> Ivone --
> You are using a PERL invocation for php.  PHP scripts begin <?php

#! is not a perl invocation, it is a Unix convention to tell the shell 
which program should be used to process the file contents. If you are 
running PHP as a CGI from a webserver, chances are good you do want
#!/path/to/php as the first line, and <?php on the next line.

I don't think you can pass a flag like #!/usr/bin/php -q though, and I
doubt you would want to, since you still need to send the headers upon
first output. If you did not send headers and just started outputting, the 
server would return a 500 Internal Server Error.

The directory you're running it from needs to have ExecCGI permission
(i.e. /cgi-bin/) and assuming no special setup has been done, you probably
want to start the file off with that #! line as mentioned above. Also, you
may want to try naming the file .cgi

> the # sign is a comment in PERL - not in PHP.

# also denotes a comment in PHP. Though #! is not a comment, per se.  
(However, if you feed the file directly to some interpreter like perl, it
does have the benefit of being ignored as a comment.)

> To run php as cgi you need to install the php cgi version (as opposed to
> the apache modular installation.)  That will allow you to run cgi
> scripts on the command line.

CGI stands for common gateway interface, which is the interface between a
web server/request and some external program, so it has little to do with
the command line. However, to run PHP from the command line, you do need
to run it with the "CGI version" of PHP. The question did not specify 
needing to run PHP from the command line, but as a CGI by the webserver.

--
Kelly Hallman
// Ultrafancy

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

Reply via email to