• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Php not working correctly

P

phippster12

Guest
My client is trying to use php extensions. So that he can have a site with the url

blah.com/index.php?id=3. Unfortunately php file isn't reacting to the ?id= no matter what it is. I enabled php scripting, but I don't know what to do to fix this problem. Anyone know the solution.
 
This is a setting in PHP.
register_globals = on
register_globals = off

Using your PHP script example, blah.com/index.php?id=3
if register_globals is on, then you can access the variable id directly since PHP will automatically make the GET variables available to your script.

if register_globals is off, then you have to call the variable id like: $_GET['id']

There are several things you can do.

1. On a script by script basis, add the following lines to the top of your PHP script:
<?php
if(!empty($_GET)) extract($_GET);
if(!empty($_POST)) extract($_POST);
?>

2. On a site by site basis, add the following line to a .htaccess file:
php_flag register_globals 1

3. For all php scripts and sites on your server. Probably the best way, just edit your php.ini file and search for and change register_globals = on

More information is found here:
http://us2.php.net/manual/en/security.globals.php
 
BlueSparks You Da Man

BlueSparks,

Thank you so much for your timely response. The code:

<?php
if(!empty($_GET)) extract($_GET);
if(!empty($_POST)) extract($_POST);
?>

worked perfectly when I added it to all my files. Thank you so much, you saved my behind on this client. PS: YOU DA MAN.
 
Back
Top