Quote:
|
Originally Posted by zagi
For example with PHP you must run with safe mode enabled along with a slew of other options that will need to be enabled to ensure proper security, mind you though that a number of scripts will not run with safe mode turned on.
|
For scripts that don't run with " safe_mode" on :
Activate Safe Mode Using Per Site Basis
Now if you have scripts that require safe mode off like Modernbill or any script doesn't work well with safe_mode on what you will do? Disable safe_mode on the entire server just for these scripts? This isn?t very practical when you can disable php safe mode per user account/site basis.
Let?s do it!
1) SSH to your server and login as root.
2) Then find the httpd.conf, normally it?s in /etc/httpd/conf/ or /usr/local/apache/conf/
If it?s not in either of those places try search for it: locate httpd.conf
3) Then find the site you wish to edit.
Ctrl+W and type in the domain name
You should see something like this:
PHP Code:
<VirtualHost ***.***.***.***>
ServerAlias www.domain.net domain.net
ServerAdmin webmaster@domain.net
DocumentRoot /home/domain/public_html
BytesLog domlogs/domain.net-bytes_log
ServerName www.domain.net
User domain
Group domain
CustomLog domlogs/domain.net combined
ScriptAlias /cgi-bin/ /home/domain/public_html/cgi-bin/
</VirtualHost>
4) Now add this line:
php_admin_flag safe_mode Off
We have also found that the following works as well if the above does not but DO NOT USE BOTH, pick one!
php_admin_value safe_mode 0
to be like this :
PHP Code:
<VirtualHost ***.***.***.***>
ServerAlias www.domain.net domain.net
ServerAdmin webmaster@domain.net
DocumentRoot /home/domain/public_html
php_admin_flag safe_mode Off
BytesLog domlogs/domain.net-bytes_log
ServerName www.domain.net
User domain
Group domain
CustomLog domlogs/domain.net combined
ScriptAlias /cgi-bin/ /home/domain/public_html/cgi-bin/
</VirtualHost>
5) Good

Now save the changes.
Ctrl + X then Y
6) Restart the Apache web server by
/etc/init.d/httpd restart
Final Words
PHP Safe mode should be on by default on all your servers for added security. However there are some scripts that are not compatible with it on so you have to make an exception to some client sites. Make sure you know why they?re requesting to have it turned off because it is much more secure for everyone to have it on.
If you run into trouble after editing httpd.conf you can run the apachectl configtest
in shell. This will test the Apache configuration for errors and report them back to you if you can?t start it, very handy indeed!