Re: How to integrate PHP with my homegrown server
| From: | Steve Francisco | Date: | Fri, 24 Aug 2007 15:57:41 +0000 |
| Subject: | Re: How to integrate PHP with my homegrown server | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-31901@lists.php.net to get a copy of this message | ||
Daniel Brown wrote:
On 8/24/07, Steve Francisco <cisco@gremlin.ca> wrote: [snip!]But you made me realize there is a way. I wrote a small "pre.php" file like this: <?php # for($i=1;$i<count($argv);$i++) {If the command line doesn't have a way to cause $_GET to be populated, then what other way of invoking PHP could I use? -- SteveSteve,You'd need to transpose the $_GET variables from the request to$argv variables via the CLI. I don't know exactly how Java would handle it, but the PHP equivalent (though rather recursive and unnecessary, it's just here for demonstration purposes) would be: Thanks Daniel, I can certainly do that in Java without much trouble, however I was hoping to avoid needing to do things in each php file to convert argv into $_GET. I want to be able to serve standard PHP without modifying each one.
$variables = split("=",$argv[$i]);
$_GET[$variables[0]] = $variables[1];
}
?>
and in my php.ini, I set this:
auto_prepend_file =e:\php523\pre.php
Now it works fine without having to modify the php code! All I need to do is have the Java code set up the html parms as argv, and I'm done.
-- Steve