|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
I wanted to set up and apache server with php5 and mysql on my WinXP Pro machine for testing of my php scripts as i write them.
I set up Apache2 and PHP5 according to very explicit instructions found on several websites offering tutorials on the subject. I have all of my .ini and .dll files and such in the right places and my server starts, displays files with .html and .php extensions. However, as soon as I want to execute a php script as simple as the following: <?php if ($id == '1') { echo "You clicked the link!"; } else { printf("<a href=\"%s?id=1\">Click Me</a><br>\n", $PHP_SELF); } ?> , things go wrong. Following the above code as an example of my problem, it is supposed to display a link with the text "Click Me," with the link pointing back at the script with "?id=1" attached to the end of it. When you click the link and the script sees the value for $id (as per the "if ($id == '1')" statement), it should then print "You clicked the link!" However, all it does it print "Click Me" again. This happens on any script that i send information back at, like forms and such...it just reprints what was originally there. I have tested these scripts on a friend's preconfigured server (IBServer), and they work PERFECTLY. I must be doing something wrong... If anyone has any ideas as to what the problem might be, please help me! I'm desperate! Thank you in advance. |
|
#2
|
||||
|
||||
|
Change if "($id == '1')" to "if ($_GET['id'] == '1')". This is a register_globals problem. There's a very good sticky on this topic in the PHP forum that you should definitely check out.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
|||
|
|||
|
Thank you very much, dhouston. This solved the problem right away. Thanks also for the tip about the register_globals thread; it does shed some light on things I was confused about. Thanks again.
![]() |
|
#4
|
|||
|
|||
|
Finally the post works...
I have had the same problem and after many hours ... the problem is resolved changing one word in php.ini.
If you find php.ini (Windows directory or other) and change register_globals = Off to register_globals = On, everything is ok. You can read more information in: http://uk.builder.com/webdevelopment/scripting/0,39026636,39213078-2,00.htm |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Server Configuration > Problem with PHP5 and Apache2 on WinXP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|