Preface: This article is aimed at the Windows PHP environment, and the Linux system is not within the scope of discussion.
For security reasons, the server does not allow PHP or other languages to execute exec commands. When you have special needs for PHP to execute exec commands on the server, you need to set two places, otherwise the execution will not be successful.
1. Modify php.ini
Find the php configuration file php.ini. If you use the extraterrestrial 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 then save the file.
2. Modify cmd.exe file properties
Enter C:WINDOWSsystem32, find the file cmd.exe, right-click -> Properties, add the Internet guest account in the "Security" settings, that is, the IUSR_****** account, and then assign "Read and "Run" and "Read" permissions.
After this setting is completed, php can execute the exec command on the server.