I encountered two errors caused by php.ini configuration errors: ajax image upload error and exec error.
First of all, the first one:
While doing an ajax image upload function, php reported such an error: File upload error - unable to create a temporary file;
Then Baidu checked it and found that it was because the configuration of upload_tmp_dir in the php.ini configuration file was not handled properly.
So Baidu downloaded this: for reference
1. Because php There is no uploaded temporary file set in .ini, and the default is the system's temporary file address.
2. If you do not have permission to read the system's temporary file directory, the above error will occur.
The solution is to remove the semicolon in front of upload_tmp_dir and set the temporary file directory.
3. If it is a WIN system, all parent folders of the set temporary folder must have the "List Folder Directory" permission of "IUSR_***** (Internet Guest Account)". It is recommended to create this temporary folder in the PHP directory.
Second: When compressing the front-end css file today, I found that it could not be compressed. The program and permissions were correct. Then I checked and found that it was due to the disable_function configuration in php.ini that caused an error when executing exec compression!
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 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 the cmd.exe file properties
Enter C:WINDOWSsystem32, find the cmd.exe file, right-click -> Properties, add the Internet guest account in the "Security" settings, which is IUSR_****** That account, and then grant "Read and Run" and "Read" permissions.
After setting up like this, php can execute the exec command on the server.
The above has introduced two errors caused by phpini configuration errors: ajax image upload error and exec error, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.