1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP safe mode problem

Discussion in 'HTML, Graphics & Programming' started by Nate, 6 Jun 2006.

  1. Nate

    Wise Guy

    Joined: 18 Oct 2002

    Posts: 1,584

    Location: Nottingham

    Having a problem with php safe mode.

    In my php code a php file is created but when you try to use this file it throws up safe mode errors when it tries to include files, saying the the uid are not the same. This is cos some files have been created and uploaded by me and this file has been created by the server.

    I have tried editing the php.ini but it doesnt seem to make a difference. When creating the file in php can i set its uid?

    :confused:
     
  2. Beansprout

    Man of Honour

    Joined: 31 Jan 2004

    Posts: 16,313

    Location: Plymouth

    Turn off safe mode :)

    Edit: Depending on the access you have to your server you can allow the uid check to be bypassed with the safe_mode_include_dir setting. So, for example, /tmp would be a good one to add (or whichever location is your temporary directory for uploaded files.)
     
    Last edited: 6 Jun 2006
  3. Nate

    Wise Guy

    Joined: 18 Oct 2002

    Posts: 1,584

    Location: Nottingham

    i have tried turning safe mode off in the php.ini

    safe_mode = false

    (that is correct yes?) and then restarted it, but it still says 'safe mode restrictions' etc

    The problem with 'safe_mode_include_dir' is the fact that the php file that is created by the server ends up in the main folder for the site.
     
  4. Beansprout

    Man of Honour

    Joined: 31 Jan 2004

    Posts: 16,313

    Location: Plymouth

    And there you see the catch 22 which makes safe mode all but useless in most environments :)

    Code:
    safe_mode               =       Off
    
    Should do the trick. It's just a boolean setting so theoretically 0, false should also work too o.o. Double check you're editing the main, one and only, correct php.ini :)
     
  5. Nate

    Wise Guy

    Joined: 18 Oct 2002

    Posts: 1,584

    Location: Nottingham

    i edited the main php.ini on the server and then did a find and found the site specific one, and that is already set to off?

    safe_mode = Off

    but it is throwing safe mode errors. How can this be?