Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21669 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48120 invoked by uid 1010); 24 Jan 2006 11:30:38 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 48105 invoked from network); 24 Jan 2006 11:30:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jan 2006 11:30:38 -0000 Received: from ([127.0.0.1:22795]) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with ECSTREAM id B2/74-06819-EDF06D34 for ; Tue, 24 Jan 2006 06:30:38 -0500 X-Host-Fingerprint: 67.174.105.139 c-67-174-105-139.hsd1.co.comcast.net Received: from ([67.174.105.139:20262] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id CE/24-06819-62D06D34 for ; Tue, 24 Jan 2006 06:19:03 -0500 Message-ID: To: internals@lists.php.net Date: Tue, 24 Jan 2006 04:18:57 -0700 Lines: 74 User-Agent: KNode/0.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Posted-By: 67.174.105.139 Subject: PHP and Non-Apache From: roguestar191@comcast.net (Matthew) Hello all, I hope this is the right place to write about this. I've been trying now for quite some time to integrate php into my non-apache server (completely c++ written by me). Right now I have it working partially using the CLI. My application generates a shell script when a .php page is requested and executes it through p_open so I can pipe standard output back to the user that requested it. The script generated looks something exactly like: #!/bin/bash cd /path/to/server/ant/httpd/phpBB2/ export REQUEST_METHOD="GET" export SCRIPT_NAME="/phpBB2/index.php" export SERVER_NAME="localhost:5555" export SERVER_PORT="5555" export REMOTE_ADDR="127.0.0.1" export DOCUMENT_ROOT="/path/to/server/ant/httpd" export DOCUMENT_URI="/phpBB2/index.php" export DOCUMENT_NAME="index.php" export SERVER_PROTOCOL="HTTP/1.1" export SERVER_SOFTWARE="ANT-1.0" export GATEWAY_INTERFACE="CGI/1.1" export HTTP_USER_AGENT="User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4 " export HTTP_ACCEPT="text/xml,application/xml,application/xhtml xml,text/html;q 0.9,text/plain;q=0.8,image/png,*/*;q=0.5" export HTTP_ACCEPT_LANGUAGE="en-us,en;q 0.5" export HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q 0.7,*;q=0.7" export HTTP_ACCEPT_ENCODING="gzip,deflate" php -f /path/to/server/ant/httpd/phpBB2/index.php cd /path/to/server/ant/ export > ExportsAfterScript with path/to/server/ant being automatically generated by "pwd", and httpd being inserted as the base httpd directory. I tried doing it this way, because this seems to be how CGI scripts work (from what I could gather from the tons of documents I've tried reading on the web), so I figured maybe this would work, of course it doesn't. I also read cgi scripts may export values to the enviorment after it finish's so I thought php might too, which is why export > ExportsAfterScript is there. This method works fine and dandy for simple scripts like or whatever that is, but it doesn't work with a little more advanced things like phpBB. Now I'm wondering, can I simply link the library in at compile time, do a #include , create a structure with all the exported data and pass it to a function in php? Can anyone provide me with some pointers like, the object I need to create, the function I need to call to get parse a file This is what I'm looking for (general psuedo to pass the idea): { #include void runPhP(HttpdUserObject *userobject, char *file, size_t &filesize) { struct phpHeader header = CreateHeaderFrom(userobject); char *result = PHPProc(file, filesize, header); struct phpResultHeader headerback = PHPResultHeader(); Send_To_User(userobject, headerback, result); free(result); return; }; // and call that from my file loading routines if a .php extension is found? and something like: In makefile.am add -lphp and -i/usr/include/php-X/ } Any help would be greatly appreciated, thanks! Matthew Adams http://www.sf.net/projects/ante --------------------------------- Long live free and open software!