For security reasons, the server does not allow php or other languages to execute the exec command. when you have special requirements for php to execute the exec command on the server, you need to set two places, otherwise, the execution will fail. This article does not discuss the linux system in the windows php environment.
For security reasons, the server does not allow php or other languages to execute the exec command. when you have special requirements for php to execute the exec command on the server, you need to set two places, otherwise, the execution will fail.
1. modify php. ini
Find the php configuration file php. ini. if you use the out-of-the-stars php automatic installation program to configure the php environment, this file is in the C: \ WINDOWS \ directory.
Search for "disable_functions" in the file, find it, remove "exec" and "shell_exec", and save the file.
2. modify attributes of the cmd.exe file
Go to C: \ WINDOWS \ system32, find the cmd.exe file, right-click-> properties, and add the Internet guest account in "security" settings, that is, the IUSR _ ****** account, then Grant "Read and run" and "read" permissions.
In this way, php can execute the exec command on the server.