Web Hosting Talk







View Full Version : How to turn PHP safe mode off?


mrzippy
10-04-2002, 12:14 AM
I am trying to use the backquotes to execute a system command, but it says the following message:Warning: Cannot execute using backquotes in safe mode in /home/virtual/site1/fst/var/www/html/test.php on line 9

So.. I guess I need to turn off safe mode. I have no idea how to do this.

Can anyone walk me through? phpinfo() says that my "safe_mode" directive is off for Master Value, but is on for Local Value.

I guess there's a switch somewhere I need to set?

Thanks!

FuelGuru
10-04-2002, 12:44 AM
http://www.php.net/manual/en/features.safe-mode.php

In php.ini set safe mode to off I believe.

mrzippy
10-04-2002, 12:54 AM
My php.ini already is telling me that safe_mode is off.

This is from my php.ini file:

;
; Safe Mode
;
safe_mode = Off


Does anyone know why the Master Value says off, but the Local Value says it is on?

What does local value mean? How can I set this off?

Thanks!

FuelGuru
10-04-2002, 01:00 AM
did you restart?

FuelGuru
10-04-2002, 01:07 AM
Apache --- Sorry do not restart the server just restart Apache the service.

blacknight
10-04-2002, 01:24 AM
The 'master' value is your php.ini , while the 'local' one refers to the directory you are looking at.

Basically you can override/change the local value using a .htaccess

I'd advise you to poke around on the PHP site.

mrzippy
10-04-2002, 08:55 AM
Originally posted by blacknight
The 'master' value is your php.ini , while the 'local' one refers to the directory you are looking at.

Basically you can override/change the local value using a .htaccess

I'd advise you to poke around on the PHP site.

I have confirmed that the php.ini file has safe_mode set to off, and have restarted apache to make sure.

So now I need to find out why the Local Value is set to on..

Is there a way to search all files within a group of directories for the words "safe_mode"? I looked at the .htaccess file for the directory, but couldn't find anything to do with php. I figure maybe I can search for this text and then simply look inside each resulting file to see if it is being set there.

Thanks.

net-trend
10-04-2002, 09:04 AM
Look at the link fuelguru posted above, read the whole page. That's the answer you need. :)

mrzippy
10-04-2002, 10:41 AM
Originally posted by net-trend
Look at the link fuelguru posted above, read the whole page. That's the answer you need. :)

I must be stupid, then. :confused:

After reading that whole page three times I still can't figure out how to set the Local Value of safe_mode to off. I've looked in php.ini, httpd.conf, .htaccess files and a few other places, but can't find anywhere that has safe_mode set to on.

Can anyone help?

goodness0001
10-04-2002, 11:01 AM
Are you using any sort of hosting control panel?

mattschinkel
10-04-2002, 03:27 PM
just add this to the end of the httpd.conf file and restart apache.

<Directory /var/www/html>
php_admin_flag safe_mode off
</Directory>