Turn off safe_mode in the php.ini

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
michslle
Forum Newbie
Posts: 3
Joined: Sat Jun 16, 2007 2:52 pm

Turn off safe_mode in the php.ini

Post by michslle »

Hi, does anyone knows how to turn off safe_mode in the php.ini?

I cannot even find any php.ini in my server, do you know where i must look for?

I read in articles, saying:
To Turn off PHP "safemode" on Your Linux Virtual Dedicated Server
1. Using SSH, connect to your server.
2. Once you are logged in, type su -.
3. For your password, type the same password you used to connect to your server.
4. At the command prompt type: vi /etc/php.ini
6. Go to the line safe_mode = on and press the "i" key.
7. Change the line to safe_mode = off and press the "Esc" key.
8. Type :wq and press Enter to save your file and quit vi.

I have access to etc but i cannot find any php.ini in it...

Please kindly help, i need this urgently.
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

/etc/php.ini is a possible location, but more likely it's under /usr/local/php/lib/php.ini or possibly /etc/httpd/php.ini

Since you seem to have access to the command line via SSH and can operate as root, try these commands:

prompt# locate php.ini

That should tell you right away, if it doesn't, locate the php binary:

prompt# which php (to essentially check if the php binary is in your PATH and where it might be found)
prompt# php --ini

Barring that, list the /etc directory and see if there is an 'httpd' or 'apache' directory there, search those paths. Also look under /usr/local, another likely place for a PHP installation.

Oh, one other option, create a phpinfo() script and check the output from that:

Code: Select all

<?php phpinfo();?>
michslle
Forum Newbie
Posts: 3
Joined: Sat Jun 16, 2007 2:52 pm

Post by michslle »

Thank very much for your reply. But I am unable to see /usr/local/php/lib/php.ini and /etc/httpd/php.ini. And do not have access to SSH too.

And I did phpinfo(), it says

safe mode for Local Value -> On
safe mode for Master Value -> Off

Is there a way to turn off the local value?
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post by bdlang »

Hmm. Based on your first post, you seem to indicate that you have console access to this server; at any rate, I was directing you to view the output from phpinfo() so you could see where the php.ini file exists. (under 'Loaded Configuration File').

Anything you want to know can surely be found in the PHP Manual sections on 'Safe Mode' and 'php.ini directives'.

These indicate that you can only alter safe mode options in the php.ini or httpd.conf configuration files. What would the purpose be if you could alter these directives as a normal user?
michslle
Forum Newbie
Posts: 3
Joined: Sat Jun 16, 2007 2:52 pm

Solved

Post by michslle »

Thanks very very much for your help, really appreciate you alot.

Solved it, i was using Plesk control panel.

If you click on the url, and select Group Action, you will be able to find the safe mode can be turned off or on .

Thank again.
aziz
Forum Newbie
Posts: 1
Joined: Sat Jul 21, 2007 1:22 pm

Can you tell howm you made this solve?

Post by aziz »

Hello,

I am facing same problem so please tell me which way you made it solve?

Thanks,
Aziz Rattani
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: Solved

Post by Ollie Saunders »

michslle wrote:Solved it, i was using Plesk control panel.
ewww
I am facing same problem so please tell me which way you made it solve?
Did you read the thread history?
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

And why in the world are you wanting to run with Safe Mode off?

{shudders}
User avatar
stereofrog
Forum Contributor
Posts: 386
Joined: Mon Dec 04, 2006 6:10 am

Post by stereofrog »

Perhaps for the same reason people turn register globals or magic quotes off: it causes more problems that it attempts to solve. And it will be removed in php6.
User avatar
The Phoenix
Forum Contributor
Posts: 294
Joined: Fri Oct 06, 2006 8:12 pm

Post by The Phoenix »

AKA Panama Jack wrote:And why in the world are you wanting to run with Safe Mode off?

{shudders}
Because Safe Mode is false security.

http://ilia.ws/archives/18-PHPs-safe_mo ... urity.html
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

AKA Panama Jack wrote:And why in the world are you wanting to run with Safe Mode off?
And why in the world would you want to run with Safe Mode on?
Post Reply