Web Server Configuration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Server Configuration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 31st, 2002, 11:31 AM
indigoe indigoe is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 2 indigoe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry php not working properly - apache's fault?

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.

Reply With Quote
  #2  
Old May 31st, 2002, 08:27 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
  #3  
Old May 31st, 2002, 09:13 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
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.

Reply With Quote
  #4  
Old June 1st, 2002, 06:48 AM
indigoe indigoe is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 2 indigoe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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).

Reply With Quote
  #5  
Old June 1st, 2002, 12:31 PM
epyon epyon is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Chicago
Posts: 22 epyon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
3.2?
why are you using that?

it's at 4.2 now, unless that's what you meant.

Reply With Quote
  #6  
Old June 2nd, 2002, 12:42 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
Quote:
Originally posted by epyon
3.2?
why are you using that?

it's at 4.2 now, unless that's what you meant.


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

Reply With Quote
  #7  
Old July 2nd, 2002, 05:01 PM
mrgoose mrgoose is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 2 mrgoose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to mrgoose
Angry Same problem

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

Reply With Quote
  #8  
Old July 25th, 2002, 02:24 PM
lullabud lullabud is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: in the basement
Posts: 2 lullabud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to lullabud
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...

Reply With Quote
  #9  
Old July 25th, 2002, 02:31 PM
lullabud lullabud is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: in the basement
Posts: 2 lullabud User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to lullabud
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. =)

Reply With Quote
  #10  
Old July 25th, 2002, 02:50 PM
mrgoose mrgoose is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 2 mrgoose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to mrgoose
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

Reply With Quote
  #11  
Old July 25th, 2002, 04:39 PM
Lindset Lindset is offline
weirdomoderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Alta, Norway
Posts: 370 Lindset User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to Lindset Send a message via AIM to Lindset
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:
<?PHP

echo $_REQUEST['test']; // Would echo "hah"

echo $_GET['test']; // Would echo "hah"

echo $_POST['test'/* Would echo nothing,
because it's not submitted using the post method,
but the get method*/

?>


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

Reply With Quote
  #12  
Old May 8th, 2005, 01:20 PM
strider72 strider72 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 strider72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 57 sec
Reputation Power: 0
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;
}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Server Configuration > php not working properly - apache's fault?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT