Home >Backend Development >PHP Problem >How to turn off php's safe_mode mode?
Close method: In the php.ini configuration file, look for "safe_mode =" and set it to "safe_mode = Off"; then restart php, or restart the entire environment to turn off php safe_mode mode (safe mode) .
How to turn off the safe_mode mode of php
Some environments turn on the safe mode (safe_mode), which will cause Many PHP built-in functions of the program cannot be used, and the system will be paralyzed. It is recommended to close it.
Set safe_mode = Off
in the php.ini file, and then restart php, or restart the entire environment. [Related tutorial recommendations: "PHP Tutorial"]
As shown in the picture:
##Expand information
What is PHP safe mode: safe_mode
Simply put, PHP safe mode is to run php in safe mode. php's safe mode provides a basic secure shared environment on a php open web server where multiple user accounts exist. When PHP is running in safe mode on a web server, some functions will be completely disabled and some available functions will be limited. In safe mode, some functions that try to access the file system will be restricted. Running the web server user ID, if you want to operate a certain file, you must have read or write access rights to the file. There is no problem for PHP to implement this restriction function. When safe mode is turned on, when trying to read or write a local file, PHP will check whether the current accessing user is the owner of the target file. If you are not the owner, the operation will be disabled. (Writing permissions: Under lower-level file access permissions, it may be allowed to read or write files in the system operating system. This is achieved through PHP's safe mode to prevent you from operating another user's files. Operation. Of course, a web server may be able to access an arbitrary file with global write permission.)When safe mode is turned on, the functionality of the following function list will be restricted:chdir, move_uploaded_file, chgrp, parse_ini_file, chown, rmdir, copy, rename, fopen, require, highlight_file, show_source, include, symlink, link, touch, mkdir, unlinkSame, Some functions in PHP extensions will also be affected. (Loading module: The dl function will be prohibited in safe mode. If you want to load an extension, you can only modify the extension options in php.ini and load it when PHP starts) Opened in PHP safe mode When you need to execute a system program, it must be the program in the directory specified in the safe_mode_exec_dir option, otherwise the execution will fail. Even if execution is allowed, it will automatically be passed to the escapeshellcmd function for filtering. The following function list for executing commands will be affected: exec,shell_exec,passthru,system,popenIn addition, the back marking operator (`) will also be affected closure. When running in safe mode, although no error will be caused, the putenv function will be invalid. Similarly, other functions set_time_limit and set_include_path that try to change PHP environment variables will also be ignored. Recommended learning:
PHP programming from entry to proficiency
The above is the detailed content of How to turn off php's safe_mode mode?. For more information, please follow other related articles on the PHP Chinese website!