• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Can't disable PHP safe_mode

GuillaumeH

Basic Pleskian
Hi,


I want to disable for a website the PHP safe_mode. I edit the domain, desactivate the SAFE_MODE option. But it change nothing.

in "/var/www/vhosts/<domain>.com/conf/httpd.include" the value "php_admin_flag safe_mode on " stay.

It seems that Plesk can't modify "/var/www/vhosts/<domain>.com/conf/httpd.include"
 
Result of the command : SUCCESS: Update of domain '<domain>.com' complete.


But /var/www/vhosts/<domain>.com/conf/httpd.include is still not modified and SAFE_MODE is still active :(
 
Last edited:
. Several scripts for the website need this SAFE MODE desactivate, and I can't change this parameter.

However it works at the creation of a domain. But not editing an existing domain...
 
I can't reproduce it on my test environment:

# grep -i safe_mode /var/www/vhosts/ibutorin.plesk.ru/conf/httpd.include
php_admin_flag safe_mode off
php_admin_flag safe_mode off
php_admin_flag safe_mode off
php_admin_flag safe_mode off

# /usr/local/psa/bin/domain --update ibutorin.plesk.ru -php_safe_mode true
SUCCESS: Update of domain 'ibutorin.plesk.ru' complete.

# grep -i safe_mode /var/www/vhosts/ibutorin.plesk.ru/conf/httpd.include
php_admin_flag safe_mode on
php_admin_flag safe_mode on
php_admin_flag safe_mode on
php_admin_flag safe_mode on

# /usr/local/psa/bin/domain --update ibutorin.plesk.ru -php_safe_mode false
SUCCESS: Update of domain 'ibutorin.plesk.ru' complete.

# grep -i safe_mode /var/www/vhosts/ibutorin.plesk.ru/conf/httpd.include
php_admin_flag safe_mode off
php_admin_flag safe_mode off
php_admin_flag safe_mode off
php_admin_flag safe_mode off

Maybe there is something wrong with permissions for config file?
 
# grep -i safe_mode /var/www/vhosts/mydomain.com/conf/httpd.include
php_admin_flag safe_mode on
php_admin_flag safe_mode on

# /usr/local/psa/bin/domain --update mydomain.com -php_safe_mode false
SUCCESS: Update of domain 'mydomain.com' complete.

# grep -i safe_mode /var/www/vhosts/mydomain.com/conf/httpd.include
php_admin_flag safe_mode on
php_admin_flag safe_mode on

httpd.include as the following right in octal: 0644 root root
 
Yes, it is correct permissions. But I can't reproduce it on different servers. Therefore I can suggest you contact support team for checking this problem directly on your server.
 
I've found a sort of solution

- I desactivate the domain, so plesk delete /var/www/vhosts/mydomain.com/conf/httpd.include
- I reactivate the domain, with the safe mode disabled


Now the httpd.include is recreate with the good parameters.
 
This appears to be a greater issue in 9.5...

[root@aries ~]# grep -i safe_mode /var/www/vhosts/**********.co.uk/conf/httpd.include
[root@aries ~]# /usr/local/psa/bin/domain --update **********.co.uk -php_safe_mode false
SUCCESS: Update of domain '**********.co.uk' complete.
[root@aries ~]# grep -i safe_mode /var/www/vhosts/**********.co.uk/conf/httpd.include
[root@aries ~]# /usr/local/psa/bin/domain --update **********.co.uk -php_safe_mode true
SUCCESS: Update of domain '**********.co.uk' complete.
[root@aries ~]# grep -i safe_mode /var/www/vhosts/**********.co.uk/conf/httpd.include

Putting safe_mode off flag in vhost.conf also doesn't work.

How are we supposed to disable safe mode?
 
All works fine for me on 9.5.1:

# grep -i safe_mode /var/www/vhosts/domain34r.com/conf/httpd.include
php_admin_flag safe_mode on
php_admin_flag safe_mode on

# /usr/local/psa/bin/domain --update domain34r.com -php_safe_mode false
SUCCESS: Update of domain 'domain34r.com' complete.

# grep -i safe_mode /var/www/vhosts/domain34r.com/conf/httpd.include
php_admin_flag safe_mode off
php_admin_flag safe_mode off

# cat /usr/local/psa/version
9.5.1 CentOS 5 95100414.15
 
nearly the same problem
if i do a phpinfo() then it shows safe_mode=on
but in the httpd_include safe_mode param =off

how do i disable safe mode?
 
Same problem is on two of our servers too. One is Plesk 9.5.1 and other is Plesk 8.6.

/usr/local/psa/bin/domain --update domain.com -php_safe_mode false , is working fine. But the phpinfo page is still showing safe_mode as On.
 
same problem

i have the same problem - the safe-mode checkbox is ignored and creating a vhost.conf, websrvmng -a -v
and restarting apache doesnt work as well.

Seems that this is a bug and not a user specific problem.

Igor: When will be a bugfix available to make this fancy checkbox work?
 
# cat /usr/local/psa/version
9.5.2 CentOS 5 95100504.12

Before unchecking "PHP 'safe_mode' on"

# grep -i safe_mode /var/www/vhosts/dmin.com/conf/httpd.include
php_admin_flag safe_mode on
php_admin_flag safe_mode on
php_admin_flag safe_mode on
php_admin_flag safe_mode on

After unchecking "PHP 'safe_mode' on"

# grep -i safe_mode /var/www/vhosts/dmin.com/conf/httpd.include
php_admin_flag safe_mode off
php_admin_flag safe_mode off
php_admin_flag safe_mode off
php_admin_flag safe_mode off

After enabling "PHP 'safe_mode' on" I see:

# grep -i safe_mode /var/www/vhosts/dmin.com/conf/httpd.include
php_admin_flag safe_mode on
php_admin_flag safe_mode on
php_admin_flag safe_mode on
php_admin_flag safe_mode on

So, I can't reproduce it. As you can see all works fine.
 
Hi igor,

i am using debian lenny and in my case it does'nt work.

i used a clean, updated debian installation and a clean Plesk 9.5.2 installation with only two test domains. The problem appears on both domains.

Have you tried to change php processing to mod_php and then changing back to fastcgi?

Tobi
 
Hi Igor,

i have tested the issue again on a clean debian 5.0 server with a clean Plesk 9.5.2 installation.

when using mod_php the checkbox for safe_mode works fine, if is use fastcgi the checkbox has no effect.

It makes no difference if is create the user with safe mode on or of, it is alway on.

As we can see in this thread, i'm not the only only one who has reportet this issue, so please do some testing with debian lenny and 9.5.2.

Tobi
 
Hi Igor,

i have done some testing:

Clean Debian Lenny with Plesk 9.5.2 - safe_mode checkbox works fine for mod_php but has no effect in combination with fastcgi. It makes also noch difference if i create the domain with safe_mode on or off, or change it later. When using fastcgi safe_mode is alway on.

Same problem with debian Lenny and 9.5.1.

I'm sure this is a bug and should be solved immediately!

Tobi
 
I have submitted corresponding request to developers. I will update thread with results when I receive it.

Tobias S, could you please let me know - is it x32 or x64 Debian in your tests?
 
Last edited:
The ability to disable safe_mode when running PHP via FastCGI has been there since FastCGI was added as an option. It's because the apache directives for any PHP controls are never seen by the PHP process running through FastCGI - they simply have no effect. Similarly, any apache directives provided through .htaccess (on a per-domain basis) are ignored by PHP running as FastCGI.

The correct way to fix this is to have Plesk automatically create a custom php.ini and update the http.includes file for each domain to use this custom php.ini file.

The manual way to do this is described here:

http://forum.parallels.com/showthread.php?t=92562

The workaround is to simply turn safe_mode off in your /etc/php.ini

When running PHP via mod_apache, the safe_mode setting in Plesk will still work as expected, but anyone running PHP as FastCGI will instantly get safe_mode disabled.

Hope this helps.

Jordan
 
Back
Top