Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

get/post data not transfered on local apache ?

Posted on 2002-07-14
3
Medium Priority
?
169 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
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
samri earned 600 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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month11 days, left to enroll

886 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