Skip to content Skip to sidebar Skip to footer

Easy ways to disable Safe Mode in PHP

PHP logo

Calling commands in PHP is very easy with the help of functions shell_exec (), system (), and other. However, there are also hostings that switch off this function so that users can no longer use this function for reasons of site security. Using command line function calls in PHP, users can do more than usual, such as: wget, ffmpeg, rar / unrar, crontab, and so on, this is most likely not possible with standard PHP functions. Of course, this can still be overcome with the help of a simple code residing on a website’s brain system, namely: .htaccess or php.ini.

.htaccess is indeed more popular and widespread than php.ini, the difference is not only in the name but also in the layout of php.ini. If .htaccess can be created directly in the ROOT directory and works immediately, while php.ini does not always work on ROOT and is located in a different directory depending on the server operating system used. Most php.ini can work directly in the ROOT directory on a Windows server.

When safemode is enabled the website is very secure indeed, and if you write a rejected function, for example shell_exec (), the system will show text like this Warning: shell_exec () has been deactivated in blablabla for security reasons. If you’ve seen anything like this, it means that the server you are using has Safe Mode enabled. Here are 2 easy ways to solve this problem.

.htaccess

php_flag safe_mode Off

php.ini

safe_mode = Off

Above there are 2 ways you can choose one of them and I suggest using the .htaccess method first as it is very easy to do. To use it is very simple, please copy the code and go to the file manager / FTP and create a file called .htaccess, paste the code and save, if there is already a .htaccess file, paste Simply enter the code above yourself. And for php.ini please copy the code for php.ini above and enter from SSH and go to the directory /etc/php.ini or /etc/php5/php.ini according to the directory php.ini on the Server. then please insert the code in the over yourself.

From here you can see the easiest way to manipulate Sefemode. And if that method still doesn’t work, then you should Contact server manager and told him to turn off safe mode which is definitely the easier way since he doesn’t have to do anything. : Mr. Green:

Hopefully useful and good luck