Problem solved!

Problem solved!

am 03.02.2005 19:32:38 von Jerry Miller

I didn't want to give up entirely on the
flexibility of writing my scripts in C, so
I thought some more about how to get
a CGI script to use PHP without having
to spend a lot of time on PHP logic.

My first attempt was to see whether I
could substitute the extension ".php"
for the usual ".cgi" extension. I could,
but it made no difference, i.e., PHP
didn't intercept the output.

I did some searching in /usr/local/lib/php
to no avail, but then I brought up the
phpinfo page and studied it. Under the
Environment heading, I found the
variable SCRIPT_FILENAME and
passed it a test PHP filename as a
command-line argument. Voila! I
got a HTTP header and the expected
PHP-processed output!

Now all I have to do is use popen from
the C program that will become my CGI
script, and I'll be able to let C handle the
GET and/or POST query strings, create
the MySQL queries, and pass a more
manageable amount of PHP code to
access the tables. Using HTTPS should
also be more straightforward that way.

I knew there had to be a better way!

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