Solved

get/post data not transfered on local apache ?

Posted on 2002-07-14
3
167 Views
Last Modified: 2010-03-04
Hi,
I just set up a local test system (Apache 1.3.26 running as a module, PHP4, mySQL) on a W2K machine. All working fine: accessing database, processing php, showing html, etc.

One problem, though: It seems my local server does not process POST/GET informations from a form.

Look at this:

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title></title>
</head>
<body>

<?php
if (isset($test))echo"$test";
?>

<form action="test.php?test=YES" method="post" >
<input type="Submit" name="Submit" value="Submit">
</form>
</body>
</html>

Saving this code as "test.php", then viewing it within my browser, $test is not printed. That is OK, as $test is not defined yet.

By pressing the "Submit" button, I'd expect "$test" to be defined on the reload of "test.php?test=YES", so there sould be printed "YES" then.

But it isn't. The Variable "$test" is still not known.

I tried "GET" as well. Then installed PHP as CGI executable. Didn't work.
BUT, when I loaded this code to my remote (hosted) server space, it did exactly what it should. "YES" was printed on pressing the submit button.

I understand there must be something missing within my local apache (or php?) configuration.

Having not much experience with server config, I just want to create the same config locally as I have remote, to do some developing.

Any hints ? Thanks a lot.
0
Comment
Question by:MiKo93
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
samri earned 200 total points
ID: 7154771
MiKo98,

i'm still very new to PHP.   One thing I can be sure is, running PHP code as cgi is highly not-recommended for security reason.

I can comment much on why you php code does not produce a desirable result, and why it works on the remote server.

The fact that most of the thing you mentioned worked, shows that your apache+php installation should work fine, except for this specific example.

Perhaps you might want to look at how your hosting site, and you local (test) machine differs.  Yours are Win2K - how about the hosting webserver OS.  This might not be applicable, but something that might be interesting to look at.

How about revising the code to be;
(well it might not work -- I have no php coding knowledge :( )

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title></title>
</head>
<body>

<?php
if (isset($test))echo"$test";
?>

<form action="test.php method="post" >
<input name=test value=someval>
<input type="Submit" name="Submit" value="Submit">
</form>
</body>
</html>

cheers.
0
 

Author Comment

by:MiKo93
ID: 7155074
samri,

thank you very much for your comment. You are right, there is a difference between my host's OS (unix) and my local system (w2k). But this didn't cause the behaviour m.a.

Following your proposal, I managed to get the config of the remote machine and compared it to my own. Guess what ? One single entry of the PHP core configuration had to be changed :

register_globals ON

(it was OFF at my local installation). Now POST/GET works as intended.

I decided to accept your comment as an answer, as it led me to the solution. I'll give it a "medium grade", as it was a good hint, but not directly giving solution ("A" grade would be "haha, just change register_globals to ON").
This has nothing to do with the quality of your comment, but I feel right doing it that way. Hope you agree.

Again, thanks very much.
0
 
LVL 15

Expert Comment

by:samri
ID: 7155963
MiKo,

That was great.  Well... the information that gave is sure very helpful (I ought to be giving you an A grade :)

Well, the for any grades A and B, there is not much explanation required, for C and D, there should be some discussion on how to improve the grade.  Not just like some people-  throw a C, and quiet.

cheers.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question