SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member Cruz369's Avatar
    Join Date
    Nov 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question How to turn PHP register_globals off?

    Sorry for the basic question.
    How do I turn PHP register_globals to OFF status?

    Thank you.

  2. #2
    Worship the Krome kromey's Avatar
    Join Date
    Sep 2006
    Location
    Fairbanks, AK
    Posts
    1,621
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In php.ini, find the line that says
    Code:
    register_globals = On
    and change it to
    Code:
    register_globals = Off
    If for whatever reason you don't have access to php.ini, you can also set it in .htaccess or httpd.conf (if you're using Apache as your web server). If you don't have access to php.ini and you're not using Apache, you're SOL.

  3. #3
    SitePoint Addict Jamieharrop's Avatar
    Join Date
    Mar 2005
    Location
    West Yorkshire, UK
    Posts
    211
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As kromey says, this can sometimes be set using .htaccess (Not all times, depending on the server configuration).

    To try the .htaccess method, add the following line to your .htaccess file:

    Code:
    php_flag register_globals off
    If that doesn't work (It will probably give you a 500 error if it doesn't work) then try this line:

    Code:
    php_value register_globals 0
    If that doesn't work either, then it is likely your Web host has the server configured to not accept that method, and you will need to contact them to have them change the php.ini file.
    Regards,
    Jamie Harrop

  4. #4
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or if the .htaccess method doesn't work, then you might be able to have a local php.ini with only that setting.

  5. #5
    SitePoint Member Cruz369's Avatar
    Join Date
    Nov 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much!

  6. #6
    Worship the Krome kromey's Avatar
    Join Date
    Sep 2006
    Location
    Fairbanks, AK
    Posts
    1,621
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by devbanana
    Or if the .htaccess method doesn't work, then you might be able to have a local php.ini with only that setting.
    I "local php.ini" file? Is this what it sounds like, i.e. the ability to sprinkle php.ini files around the webserver in much the same way as .htaccess files? I've never heard of being able to do such a thing!

  7. #7
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yup. one example is suphp

    shared hosting, but the ability to have your own php.ini file. i think you can even have multiple files, although ive never tried. php runs through cgi.

    in the case of suphp, you must still use .htaccess(or httpd.conf) to set the location of your php.ini, but you must apply settings in your php.ini file.

  8. #8
    Worship the Krome kromey's Avatar
    Join Date
    Sep 2006
    Location
    Fairbanks, AK
    Posts
    1,621
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, I see. That's pretty handy, although I take it only really useful for shared hosting situations. Still, I shall file that away just in case it becomes suddenly relevent in the far distant future! Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •