(1) Open the safe mode of php tutorial
PHP’s security mode is a very important built-in security mechanism that can control some functions in PHP, such as system(),
At the same time, the permissions of many file operation functions are controlled, and certain key files are not allowed, such as /etc/passwd,
But the default php.ini does not open safe mode, let’s open it:
safe_mode = on
(2) User group security
When safe_mode is turned on, safe_mode_gid is turned off, then the php script can access the file, and the same
Users in the group can also access the file.
It is recommended to set it to:
safe_mode_gid = off
If we don’t set it up, we may not be able to operate the files in our server website directory. For example, we need
When operating on files.
(3) Execute the program’s home directory in safe mode
If safe mode is turned on but you want to execute certain programs, you can specify the home directory of the program to be executed:
safe_mode_exec_dir = d:/usr/bin
Under normal circumstances, there is no need to execute any program, so it is recommended not to execute the system program directory. You can point to a directory,
Then copy the program that needs to be executed, such as:
safe_mode_exec_dir = d:/tmp/cmd
However, I recommend not to execute any program, then you can point to our web directory:
safe_mode_exec_dir = d:/usr/www
1 2