Turning off PHP safe mode with Plesk
While working on an application that creates it’s own directories on the fly and then inserts images in them I came across some safe mode errors. Basically what they were is that I was creating a folder with the script which would then set the user to be ‘apache’ and then when the script went to write in it again and it didn’t actually own that folder, apache died.
I found some other more complicated solutions on the net where you have to edit the php.ini file and one where you edit the vhosts file. I figured there had to be a way to do it through Plesk and I finally found it so I figured I would share it so that no one else has to deal with it.
This is what the error looks like:
Warning: mkdir() [function.mkdir]: SAFE MODE Restriction in effect. The script whose uid is 10004 is not allowed to access /var/www/vhosts/xxx/xxx/xxxx owned by uid 48 in /var/www/vhosts/xxx/xxx/xxx/upload.php on line 98
So go into plesk and follow these steps…
- Click Domains over on the left
- Choose the domain you are wanting to disable safe mode on
- Under the hosting section choose setup
- Scroll down and under services find the one that says ‘PHP support’
- Leave that box checked but uncheck the one to the right of it that says ‘(PHP ‘safe_mode’ on )’
- Click ok and you are done.
Hope this helps.
But its turns off copletly the PHP support don’t it?
thx 4 answer
I am using Plesk 9.5.1
anyone know how to disable in this version as i don’t have the simple fix available as above.
thx
Thanks, made my Drupal website work properly online.
Nice one. I have spent hours on this problem and coundn’t understand why turning safe mode off in php.ini, failed to work. Obviously Plesk uses it’s own settings
Thank you! I also had this problem on a Drupal site
would this be an instant change? or does it depend on the host ?
I believe you have to restart Apache.
Hey thank you I was trying to install Joomla to Plesk 9 and it kept showing:
PHP safe mode off (available: on, suitable: no)
Followed these instructions (slightly different as different version) and now its fine.
Many thanks was worried I was going to have a problem there as took ages googling the problem until i came across this
Oh my god… you’ve just cured me of a 3 hour Joomla-based headache!
Thanks
Thanks a lot!
Thanks for this. I had been struggling to update wordpress for ages – have been using FTP for about a year now – and today finally decided I had to work out what was wrong.
But … what is php safe mode? By turning “safe” off is there increased risk of something bad happening?
PHP 5.4 and onwards will see safe_mode removed forever. I turn it off and just make sure my permissions are set correctly.
Annoyingly, in Plesk 10.4 there has been an update that breaks safe_mode. It remains constantly on, even when turning it off in the subscription plan settings and the domain settings themselves, meaning there’s little you can do apart from wait for a patch. There has already been one, but it doesn’t seem to work.
Thanks for the update on this Leonard, I haven’t had to use Plesk in a very long time which I’m pretty thankful for.
Obrigado! Estava com este problema a muito tempo e não achava uma solução, com isso foi muito simples.