How to turn off php safe mode in plesk 10?

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

My question was:

Please tell me how to do this from the Plesk interface (version 10).

Btw, if this is not possible through Plesk 10 interface then please tell me which one of these two files I have to change:

[root@vps ~]# find /-name php.ini
/etc/php.ini
/usr/local/psa/admin/conf/php.ini

edit: Eventually I came to see that my main problem was not the safe mode but the open base dir. The link which helped me to solve that is this: remove openbasedir restriction for a specific domain in plesk which I’ll paste here in case that blog gets pulled off:

If you have an open_basedir restriction that is causing issues with a domain, you can remove the restriction easily. First, put the following text in /home/httpd/vhosts/[domain]/conf/vhost.conf:

<Directory/home/httpd/vhosts/[domain]/httpdocs>
  php_admin_flag engine on 
  php_admin_value open_basedir none
</Directory>

# If there was already a vhost.conf in the directory, then just reload Apache. Otherwise, run the magic wand:

/usr/local/psa/admin/bin/websrvmng -av

# Then bounce Apache:

/etc/init.d/httpd reload

# BUT, if the client has both php4 and php5 things get a little more complicated, and you have to add the "IfModule" directive from the apache syntax, e.g.:

< Directory /var/www/vhosts/domain.com/subdomains/SUBDOMAIN/httpdocs>
< IfModule sapi_apache2.c>
      php_admin_flag engine on
      php_admin_flag safe_mode off
      php_admin_value open_basedir none
< /IfModule>
< IfModule mod_php5.c>
      php_admin_flag engine on
      php_admin_flag safe_mode off
      php_admin_value open_basedir none
< /IfModule>
      Options +Includes -ExecCGI
< /Directory>

# Or if you want to add a new location to open_basedir instead of disabling open_basedir, you would have:

php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp:/new/path/comes/here"

 

The answer, by Eric G, was:

Go to the control panel for the specific domain where you want to turn off safe mode, click on the Websites & Domains tab. At the bottom will be a listing of the domain names, click on an individual name to see it’s hosting settings. There should be a checkbox for PHP, and another one for whether or not to use safe mode.

See also: https://manage.grabweb.in/knowledgebase.php?action=displayarticle&id=86

Written by Nikola Brežnjak