Problem with php links

software development


A few days ago I transfered a domain to dreamhost. I moved a directory of files to the new domain and everything was fine. When I viewed the pages in the new domain, I noticed something was wrong. Some of my pages have data that is passed to them through variables in the URL. For example, I have a page like If I try to echo $value in the page, nothing happens. It’s like ?value=test isn’t even there.

I’m completely stumped as to why this is happening.


Could it be that your code from the other site relies on the use of global variables?

On DreamHost, if you use PHP5, register_globals is OFF by default; with DH’s PHP4, they are ON.

One easy way to “test” to see if this is, indeed, responsible for your error, is to set your domain to use PHP4 from the Control Panel > Domains -> Manage Domains screen. Just click the “edit” link under the “Web Hosting” column in the row for your domain, change the radio button to PHP 4x, and “save” the changes. You can always change it back to PHP5 if you wish at a later time.

If the register_globals setting was the problem, then your pages should work under PHP4. If that is the case, you can either modify your code to work without the register_globals setting being “ON” (best choice, and some info on how to do that is in that wiki article I linked above), or just run your script(s) under PHP4. :wink:



Thanks! I really appreciate your help.


You are welcome! Did that turn out to be the problem?



Yes. That was the problem. I changed the settings to php 4 and everything works fine now.


That’s great to hear, and thanks for confirming that you got it fixed; that is likely to be helpful to others having a similar problem. :slight_smile:



If you particularly want to use php5, then you can do this at the top of your page:

$value = $_GET["value"]; Do that for each querystring value you’ve got and your code should work fine. You can actually use that method whilst still using PHP 4, it’ll just be redeclaring what you’re already declared.

If you’re using a form to post variables, then replace $_GET[“value”] with $_POST[“value”].

You can use $_REQUEST[“value”] to cover both eventualities, but i like to be specific so that the server gets what i’m expecting it to.


web design, development & seo by DigitalVibe


Or, if you’re not concerned about security, which you should be, you can do this:

/** This will put all POST (forms that have the method attribute set to "post") and GET (url variables and forms that don't have the method attribute set to "post") variables into the current scope **/ extract($_REQUEST);
Visit me, please…


I am of the opinion that $_REQUEST is pure evil. It just begs for exploitation by some bit of XSS trickery.

Max discount on any plan with promocode SCJESSEYTOTAL


Indeed, that’s the reson i always use either $_GET or $_POST respectively.

Even if i’m using those, i’ve started to use my own function to protect against sql injection and validate input in one pass.


web design, development & seo by DigitalVibe