1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

Php not working correctly

Discussion in 'Plesk for Linux - 8.x and Older' started by phippster12, Jul 15, 2005.

  1. phippster12

    phippster12 Guest

    0
     
    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.
     
  2. BlueSparks

    BlueSparks Guest

    0
     
    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
     
  3. phippster12

    phippster12 Guest

    0
     
    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.
     
Loading...