• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

PHP - Safe mode for subdomains?!

albans

Regular Pleskian
I have some strange error in PHP scripts (especially DotClear - Blogs)... They're all placed under a subdomain.

After the update to Plesk8, it gets me some "SAFE MODE" errors... And I'm pretty sure that my php.ini indicates "safe_mode=off".

Is it possible to have safe_mode activated only to subdomains? How to configure this?

Thanks!
 
I found the solution...
According that the subdomain is:
SUB.DOMAIN.TLD

I had to edit the following file:
/var/www/vhosts/DOMAIN/conf/httpd.include

and modify two lines concerning the subdomain:
-----------
After the line:
ServerName SUB.DOMAIN.TLD:80
-----------
I found something like:
-----------
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value open_basedir "/var/www/vhosts/DOMAIN/subdomains/SUB/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value open_basedir "/var/www/vhosts/DOMAIN/subdomains/SUB/httpdocs:/tmp"
</IfModule>
-----------
Simply switch on to off like that:
-----------
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/DOMAIN/subdomains/SUB/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/DOMAIN/subdomains/SUB/httpdocs:/tmp"
</IfModule>
-----------
Then stop and start Apache... It'll show safe_mode for the local to off with a phpinfo.


And as a dummy, I didn't even notice the option to switch on/off safe_mode for domains in Plesk CP... Especially usefull in grouped operations... Tssss :rolleyes:
 
Did you fail to read the big header that told you not to modify httpd.include?

# ATTENTION!
# DO NOT MODIFY THIS FILE OR ANY PART OF IT. THIS CAN RESULT IN IMPROPER PLESK
# FUNCTIONING OR FAILURE, CAUSE DAMAGE AND LOSS OF DATA. IF YOU REQUIRE CUSTOM
# MODIFICATIONS TO BE APPLIED TO THE CONFIGURATION, PLEASE, PERFORM THEM IN THE
# FOLLOWING FILE(S):
# /home/httpd/vhosts/synapsestudios.com/conf/vhost.conf
# /home/httpd/vhosts/synapsestudios.com/conf/vhost_ssl.conf
# /home/httpd/vhosts/synapsestudios.com/subdomains/<subdomain-name>/conf/vhost.conf
 
Jeeez, I didn't fail to read it... I like to play with fire!

BACKUP BEFORE MODIFYING anything! That's my point of view actually! Even if Plesk told me not to do it!!!
 
if you edit for some resason subdomain from control panel safe mode will be on again

right solution for custom virtualhost configuration is :

create file
/var/www/vhosts/DOMAIN/subdomains/SUB/conf/vhost.conf
and put
<IfModule sapi_apache2.c>
php_admin_flag safe_mode off
</IfModule>
<IfModule mod_php5.c>
php_admin_flag safe_mode off
</IfModule>

then execute
/usr/local/psa/admin/sbin/websrvmng --reconfigure-all

and restart apache
 
Copy / paste from httpd.include works !!!

Example:

<Directory /var/www/vhosts/yourdomain/httpdocs>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/yourdomain/httpdocs:/tmp:/usr/share/pear"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/yourdomain/httpdocs:/tmp:/usr/share/pear"
</IfModule>
</Directory>

Restar apache and ready :)
 
Back
Top