turn off register_globals on a shared server

Discussion in 'PHP' started by Mike, Jul 27, 2005.

  1. Mike

    Mike New Member

    Joined:
    Oct 19, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.go4expert.com/
    Hello All,

    My shared server provider has register_globals on. I checked by running php_info(); from within a file. I would like to turn this off, but asking them to turn it off just for me will not work.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    register_globals server variable values cannot be set with the help of ini_set function but Entry can be set in php.ini, .htaccess or httpd.conf

    So just put the following lines in .htaccess file
    php_flag register_globals off
    php_flag safe_mode on
    Options -Indexes

    But for some reason it causes 500 Error on some hosts but not all.

    So the better option is to put the php.ini file in your home directory PHP always checks for php.ini in the root of the document before it
    checks elsewhere.

    Thanks
    Shabbir Bhimani
     
  3. Mike

    Mike New Member

    Joined:
    Oct 19, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    http://www.go4expert.com/
    "So the better option is to put the php.ini file in your home directory PHP always checks for php.ini in the root of the document before it checks elsewhere. "
    That will help
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice