473,787 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

_GET/_POST vars passed to PHP how?

Hi,

Are these passed by the webserver to PHP using
commandline arguments or by environment variable?

Just curious.

If environment variables, which ones?

Thanks,
333

Jul 21 '05 #1
2 1496
>Are these passed by the webserver to PHP using
commandline arguments or by environment variable?


If PHP is run as an Apache module, it's done via some kind of
internal interface, and unless you're writing your own modules,
you shouldn't need to care.

If PHP is run as a CGI, it's done by the interface defined by CGI:
GET variables show up in environment variables (the CGI has to
separate them), and PUT variables are available on stdin (again,
the CGI has to separate them). Environment variables indicate
whether this is GET or PUT and how much input is available on
stdin.

If PHP is run from the command line, the variables are generally
not passed at all, and there may be no web server involved at all.

Gordon L. Burditt
Jul 21 '05 #2


Gordon Burditt wrote:
If PHP is run as a CGI, it's done by the interface defined by CGI:
GET variables show up in environment variables (the CGI has to
separate them), and PUT variables are available on stdin (again,
the CGI has to separate them). Environment variables indicate
whether this is GET or PUT and how much input is available on
stdin.


As an experiment I wrote a simple C program that invokes
PHP, but I'm getting an error "No input file specified.".

What I do is:

setenv ("REQUEST_METHO D", "GET", 1);
setenv ("QUERY_STRING" , "abc=123", 1);

and then I invoke PHP thus:

system "/usr/local/bin/php myfile.php < dummyfile > foo";

and I also tried:

system "/usr/local/bin/php myfile.php dummyfile > foo";

where dummyfile is either empty or just contains the line
"abc=123".

This is very odd. Any idea as to why I'm getting
this error?

Thanks,
333

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2659
by: Phil Powell | last post by:
I have an inherited class method that is required to *only* handle items from $_POST (and $_POST alone, for security reasons), for validation and action processing. Problem is that there is a section in my application that has to put everything into an encoded query string for HTML reasons (the page is a giant form and if I were to put the stuff into individual forms, I would have a bunch of embedded forms inside one form and that is an...
4
1950
by: Sjaakie Helderhorst | last post by:
Hi, I recently installed the latest Fedora Core 2 but have some troubles of which I'm not sure are PHP or Apache 2 related... apologies if this is the wrong group. "http://www.domain.ltd/index.php?var=123&" Somehow, $var returns an empty value, while $_GET returns '123'. Need I change a parameter in php.ini or somewhere else? Thanks in advance for any help!
7
11879
by: Dan | last post by:
I was trying to troubleshoot a login page that doesn't work - it keeps saying the login/password is missing - when my tracing discovered this peculiar behavior. register_globals is off, so at the top of my script I assign a few variables to incoming GET and POST values. $login = clean($_POST, 30); $passwd = clean($_POST, 30);
7
1937
by: sketch | last post by:
I have one page that does 3 different things depending on $_GET: 1. It shows an index with items. 2. It shows an item with a form to submit an amount. 3. It confirms the amount. I was just wondering, since I haven't approached anything like this if I'm ding something I shouldn't be doing. To get the post variable to work, I had to add some get variables to the form action. Would it be better to use hidden fields? <?php
1
2169
by: stephane | last post by:
I have a problem which must be in this : print" <script type='text/javascript'> document.location.replace('http://127.0.0.1/add_task.php?req_id={$maxValue}&tk_request_name={$req_name}'); </script>"; or maybe here, in file2 <?php $tk_req_id = $_GET;
1
5684
by: stephane | last post by:
I have a problem which must be in this : print" <script type='text/javascript'> document.location.replace('http://127.0.0.1/add_task.php?req_id={$maxValue}&tk_request_name={$req_name}'); </script>"; or maybe here, in file2 <?php $tk_req_id = $_GET;
2
1778
by: lawrence k | last post by:
I noticed this odd PHP function in an article about AJAX and Prototype: > http://www.sitepoint.com/article/painless-javascript-prototype/2 > > Prototype adds a custom HTTP header to all its AJAX requests so that your server > application can detect that it's an AJAX call, rather than a normal call. The header is: > > X-Requested-With: XMLHttpRequest >
7
3365
by: amygdala | last post by:
Hi all, I'm starting this new project in which I'ld like to implement sort of a design pattern I have seen being used in the CodeIgniter framework. Basically, the site will examine the URI and based on the segments of the URI it will fire up some controller class, for instance, say I have an inbox in which end-users can view messages they got from other users, they'ld start at:
2
3142
by: keeps21 | last post by:
I have a script that recieves an id number via the address bar when a link is clicked. ie . index.php?id=1 if the link was for the story whose ID is 1. My script checks if a user is logged in, if not they are redirected to the login page. If logged in they may edit the story. I assign $_GET to $id.
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.