Jump to content

Passing arguments to php.exe


Fergo

Recommended Posts

Hey everyone, it's my first post in here.

 

I'm programming a simple webserver and I'm trying to implement php support to it. I'm getting some troubles when parsing a php file with arguments.

I have the following php file (test.php) in the same folder of php.exe:

 

<html >
<head>
<title>MyPage</title>
</head>

<body>
<?php 
    $test = $_GET['fergo'];
    echo($test);
?>
</body>
</html>

 

I don't know how to pass the php arguments to php.exe (test.php?fergo=hello for example). I was trying to do this:

php.exe -f test.php -- fergo=hello

By doing this, php.exe gave me the error:

PHP Notice:  Undefined index:  fergo in C:\Documents and Settings\Fernando\Deskt
op\php-5.2.6-Win32\teste.php on line 8

 

How can I pass the arguments to php.exe so it can parse the $_GET correctly?

Thanks in advance,

 

Fergo

 

Link to comment
https://forums.phpfreaks.com/topic/123468-passing-arguments-to-phpexe/
Share on other sites

I believe the query strings for GET and POST are processed via apache to the php engine/phraser which in turn develops its own superglobal array from the CSV style list from the query strings.

 

So you really don't see the translation working on PHP in a server enviroment because its seamless to the user

Thanks cooldude.

 

So the query strings are processed by the web server itself and then they are sent to php parser in other format, right? Do you know where I can get more information about this (which format this is, where the parser will look for the query strings, etc)? I tried php docs, but I don't know exactly what to search.

 

Again, thanks a lot.

 

Fergo

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.