Problem solved!
| From: | Jerry Miller | Date: | Thu, 03 Feb 2005 18:32:38 +0000 |
| Subject: | Problem solved! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-208021@lists.php.net to get a copy of this message | ||
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!