> -----Original Message-----
> From: Martin Ramsch [mailto:m.ramsch@stripped]
> Sent: Wednesday, August 04, 1999 2:39 AM
> To: MySQL mailing list
> Subject: PHP as CGI script (was: mysql vs. text file)
>
>
> On Di, 1999-08-03 23:14:47 -0700, Steve Edberg <sbedberg@stripped> wrote:
> > >You just have to compile PHP additionally as CGI script to use it
> > >independant from the web sever. Works fine, except for some few PHP
> > >features which are only possible as an Apache module (like the
> > >Header() function).
> >
> > I think you meant virtual()...Header() works quite nicely under CGI!
>
> You're right - and I should have look at the PHP manual ... ;)
>
> Apache specific functions are:
> - apache_lookup_uri
> - apache_note
> - getallheaders
> - virtual
> - HTTP Authentication hooks (see chapter 16)
>
I haven't tried this yet, but does php, when compiled as a CGI, now output
HTTP headers if it detects that it being run from the command-line rather
than actually as a CGI? The reason I ask is that any header() calls would
result in the PHP CGI generating HTTP headers in the output stream before
the actual html.
Of course, the solution would be just not to output HTTP headers :) after
all, we're just talking about using PHP as a template for the actual web
page...so outputting headers would be useless anyway. Same is true with the
Apache (or any other web server) specific functions.
The rule being:
if you are generating web pages with PHP, then you can use any function.
if you are using PHP as a template for generating html files to be served
staticly, then refrain from using any HTTP or web server-specific functions
(such as the functions listed above, Header(), or SetCookie()).
The only question that still remains is: does php still generate the
Content-Type: text/html header? I can't check until I can compile PHP as a
CGI.
Kelly
~kbyanc@stripped~
FreeBSD - The Power To Serve - http://www.freebsd.org/
Join Team FreeBSD - http://www.posi.net/freebsd/Team-FreeBSD