This guide explains how to enable or disable PHP safe mode globally or locally. It allows users to control the level of security restrictions applied to PHP scripts on their server environment.
Let us follow the steps:
- Globally–
- Find the php.ini configuration file on your server.
- Search for the safe_mode directive in the php.ini file.
- Change the value of safe_mode to either On or Off as per your necessity.
- Save the php.ini file.
- Restart your web server for the changes to take effect.
- Locally–
- Access your website’s root directory and find the .htaccess file.
- Insert the following code to enable or disable safe mode-
- To enable-
php_flag safe_mode On
- To disable-
php_flag safe_mode Off
- To enable-
- Save the .htaccess file.
- Authenticate the changes by opening your website and testing its functionality.
Note:
- Altering PHP settings globally may require administrative access to the server.
- Constantly backup configuration files before making changes.
- PHP safe mode has been deprecated in newer PHP versions and is no longer supported. It is suggested to use alternative security methods.
This way you can enable or disable PHP safe mode globally or locally. Should you encounter any difficulties, get direct help from our support specialists.
While handling PHP settings, don’t forget to manage your emails. Learn How to Create Global Email Filters for Your Domain in cPanel