How to pass $_GET variables to a PHP script via the command line?
        Posted  
        
            by 
                George Edison
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by George Edison
        
        
        
        Published on 2010-10-03T05:54:19Z
        Indexed on 
            2011/01/07
            22:55 UTC
        
        
        Read the original article
        Hit count: 387
        
I am trying to create a webserver that serves PHP scripts. Currently, it works as follows:
- The client requests /index.php?test=value
 - The server invokes 
php index.php - The server feeds the HTTP request headers as STDIN to the PHP process
 - The server reads the output of 
phpfrom STDOUT and returns it to the client 
All of this is working except that the parameters are not being passed to the PHP script because:
var_dump($_GET);
returns:
array(0) { }
How do $_GET parameters get passed to the PHP binary when it is invoked?
© Server Fault or respective owner