Solved

get/post data not transfered on local apache ?

Posted on 2002-07-14
3
166 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

728 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