|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
After many re-installations and following guides (just to make sure) to install php/apache, it still does not work properly. It does work to a certain extent, but not fully. I narrowed the problem to variables not passing on via the url, even tho it shows up it isnt processed. There might be more, but I dont know.
Now is this due to how php was installed, or some config thing with apache? It's been causing a lot of headaches... it would be much appreciated if someone could help me out. Btw I am using latest versions of php/apache on XP. |
|
#2
|
|||
|
|||
|
maybe try installing php on IIS?? see if it works their. other wise, it could be a matter of something in your computer is tottally screwed
|
|
#3
|
|||
|
|||
|
OK. Which version of PHP did you install? 4.2.x? If so, how are you trying to access the query string variables? If register_globals is turned off, then you'll need to use either $_GET or $HTTP_GET_VARS, which needs to be declared as global before you can get to them, like this:
<?php global $HTTP_GET_VARS; $test = $HTTP_GET_VARS["some_var"]; ?> For the $_GET array (which the PHP guys recommend you now use because they are deprecating $HTTP_xxx arrays, it's already declared at global scope, so you can just use it like this: <?php $test = $_GET["some_var"]; ?> Just double check how you're calling the variables, and if it still doesn't work just post some of your sample code here and we can work on from there. If PHP's working, then there's little chance that it's a problem with Apache. |
|
#4
|
|||
|
|||
|
Thanks for the tips, I will check them out when i get a chance. I am using php 3.2.1. The code i was using to test the problem was pasted from a simple tutorial, so in theory it should have worked any either way, with a simple default installation (such as mine).
|
|
#5
|
|||
|
|||
|
3.2?
why are you using that? it's at 4.2 now, unless that's what you meant. |
|
#6
|
|||
|
|||
|
Quote:
even if he's using 4.2.1 it's a bitch like mytch said due to some of these they've changed in it ![]()
__________________
Apache Expert |
|
#7
|
|||
|
|||
|
i too have run into the same problem... i can't seem to get it to handle http incomming vars properly, i even tried the global http thing, here's an example:
global $HTTP_GET_VARS; echo "ensureNoCache_v1 "; // $type = "word"; <--- this works fine if($type=="word"){ echo "yes"; } else { echo "no"; } then when i access the page with: URL <-- this doesn't work the return is: ensureNoCache_v1 no |
|
#8
|
|||
|
|||
|
i too am having problems
on two different fresh servers i've been working on lately i've been having the same problems. register_globals is off and for some reason it won't turn on even when i change it in the php.ini. i'm using rh7.3 LAMP setups with all the current patches, actually just compiled all my stuff on the 24th, barely got that new php 4.2.2 in there. =) anyhow, here's some sample code...
URL <?php global $GLOBALS; global $_GET; global $HTTP_GET_VARS; foreach($_GET as $key=>$val) echo("$key is $val<br>\n"); echo("blah is \"$blah\" => \"$_GET[blah]\"<br>\n"); echo("asdf is \"$asdf\" => \"$_GET[asdf]\"<br>\n"); print_r($GLOBALS); ?> and i get back... blah is 1 asdf is 1 blah is "" => "1" asdf is "" => "1" then a list of globals, which includes the the variables that were passed from the URL in the $_GET and $HTTP_GET_VARS. strange behavior, i have yet to figure out why this is happening... |
|
#9
|
|||
|
|||
|
the explanation
after posting this i did a bit more reasearch and i figured out my own answer (except as to why register_globals isn't turning on even when enabled in my php.ini) so i thought i'd post it here for anybody else who is having the problem.
URL has a long explanation of what it all means. thanks for the tips mytch. =) |
|
#10
|
|||
|
|||
|
php not processing or working
So i've figured out the problem i was having (see my previous post)
After a smooth install, i set out to test it with a small script... it seemed as though php was "alive" but it couldn't process... in otherwords, it would "print" or echo variables, but couldn't process a simple "if then" command when passed in via URL... of course it would process if the "if" condition were embedded in the script... but i was trying to pass a variable in through the URL like: URL the problem was the register_globals in the php.ini file... to be able to pass variables from a URL set register_globals to "on" from shell: vi /location/to/php.ini / register_globals a --- edit "off" to "on" ---- :wq! restart httpd (for a raq3): /etc/rc.d/init.d/httpd restart |
|
#11
|
|||
|
|||
|
You don't have to. In fact, it is encouraged to have register_globals off. Use the superglobal arrays $_GET, $_POST or $_REQUEST
Here's an example The URL: http://someurl.com/index.php?test=hah The code: PHP Code:
You see? ![]() Edit: Btw, you don't have to global the superglobal arrays, because they're already available in all scopes
__________________
Best Regards, Håvard Lindset |
|
#12
|
|||
|
|||
|
hack for registerglobals problem
i added these lines to the script im using
to do what register globals is supposed to do. foreach($_GET as $key=>$val) { $$key = $val; global $key; } foreach($_POST as $key=>$val) { $$key = $val; global $key; } |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Server Configuration > php not working properly - apache's fault? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|