How to turn off php safe_mode off for a particular directory in a shared hosting environment?

一笑奈何 提交于 2019-12-20 03:09:37

问题


Hi I'm used shared hosting. I want to turn off php safe_mode off for my site. My provider gave me a php.ini file and asked me to put it with my settings in my public_html folder to override the settings, but it didn't work.


回答1:


You can also try to create a file called php.ini in the root (public_html or other) folder, and putting the following in it:

safe_mode = Off

Depending on server settings, this may or may not work.




回答2:


Your service provider might have forgot to tell you that you need to enable your user defined php.ini configuration by adding this line in the .htaccess file that you find in your public_html folder:

#Activates php.ini config located in main folder to work also recursively for all subfolders
suPHP_ConfigPath /home/YOUR_CPANEL_USER_NAME/public_html

Obviously replace YOUR_CPANEL_USER_NAME with your cPanel user name.

I'm supposing your server has got suPHP module(which is quite common in nowdays).

BTW: the php.ini file need to be in /home/YOUR_CPANEL_USER_NAME/public_html too and inside you should write this:

safe_mode = Off

And remember that Safe Mode is deprecated in PHP 5.3.0 and is removed in PHP 6.0.0.




回答3:


TRY:

You can turn it off by adding the following line to a .htaccess file in your root (public html) folder.

If the .htaccess file doesn't exist, you can create it using a simple text editing program.

php_flag safe_mode Off


来源:https://stackoverflow.com/questions/1982197/how-to-turn-off-php-safe-mode-off-for-a-particular-directory-in-a-shared-hosting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!