Does anyone know how to enable variables in URL to be read?

Hi All

I am trying to move a huge number of sites from an old Apache (Windows) installation to our Virtualmin site, but we have encountered a problem doing this.

On the old setup we allow for GET variables in the URL, so if you used the following URL

http://domain.tld/test.php?id=22&type=highprofile

In the test.php file our users normally read the URL just by referring directly to the variable $id and $type.

But when we moves the sites to Virtualmin the variables are not available because they doesn’t use the method $get_[‘id’] and $get_[‘type’] to get access to them.

Is it possible to active this within the actual virtual site so that we doesn’t have to edit / change millions of lines of code for our users???

Looking forward to hear from anyone how can help me regarding this.

-Tim

Well, that’s an old-style way of accessing variables in PHP. The ability to do that is no longer something PHP enables by default, and is considered a bit of a security risk.

However, if you’d like to enable that, what you can do is edit the php.ini file, and set “register_globals” to “On”.

You can read more about that here:

http://php.net/manual/en/security.globals.php

Hi Jamie

Yes, I know that it may be a security risk but I can’t demand the users to change it before moving it to the new server :confused:
Is it possible to activate this for the specific sites needed, so that it won’t be a global setting like on the old server?

I found this in the Virtualmin -> Services -> PHP 5 Configuration -> PHP Variables

Turn all input into global variables?
Turn command-line parameters into global variables?

Have this anything to do with the “register_globals” option?

-Tim

Howdy,

You can enable that per-domain, if your domains are using the default FCGID or CGI PHP Execution Mode. If you’re using “mod_php”, you’d have to enable it server-wide.

I think the variable you’re seeing there is what you’d want. Alternatively, you could edit $HOME/etc/php.ini, and enable register_globals there.

-Eric

Hi Eric

Sorry, I didn’t read that it was you that replied my post and not Jamie :wink:
It worked by changing the 2 settings within the PHP Variables.

Thanks alot

-Tim