PHP CLI vs WebServed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,
  I've been using PHP for a very long time now, a few years ago
developing webapplications with apache and mysql, now and for a few
years using mostly the CLI (mostly as a replacement of all other
scripting languages available on linux, sh, pearl, etc...).  However,
I'm building a project that works very much like a webserver (and does
much custom stuff) and i would like to execute php files in a similar
way as they are executed by a server like apache.

  I've been executing php from my C/C++ executable simply by writing
the HTTP query string in a temp file (/dev/shm/...) and then executing
the php file like so:
// usage is:  phpfile.php  <input/querystring file>  <output file destination>
system("php /path/to/phpfile.php
/dev/shm/this_executions_querystring.txt
/dev/shm/this_execution_output_destination.txt");

  But the problem is that this phpfile.php has to be made to read the
content of the querystring file to get it, etc...  also this design
will write the output file to /dev/shm, which is then read and sent my
the main program.  I'm going to use popen in the future...
  I'd prefer if i could somehow, on the CLI, set the global variables
like $_SERVER and others...  this would make it so my software could
execute any php file that was built for another webserver
transparently.  Is this possible on the CLI?  Is there a simple way to
do what I want?  (Btw, the server is already handling all the HTTP
packaging/parsing, the problem is really just with the execution)

Thanks in advance for any suggestions!

Simon
-- 
When Earth was the only inhabited planet in the Galaxy, it was a
primitive place, militarily speaking.  The only weapon they had ever
invented worth mentioning was a crude and inefficient nuclear-reaction
bomb for which they had not even developed the logical defense. -
Asimov

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux