Two errors caused by php. ini configuration errors: ajax image upload error and exec error. _ PHP Tutorial

Source: Internet
Author: User
Two errors caused by incorrect php. ini configuration: ajax image upload error and exec error ,. Because php. ini configuration error: ajax image upload error and exec error. ini configuration error: ajax image upload error and exec error. ini configuration error: ajax image upload error and exec error,

Two errors were reported due to incorrect php. ini configuration: ajax image upload error and exec error.

First, first:

In the ajax image upload function, php reports the following error: File upload error-unable to create a temporary file;

Then Baidu found that the configuration of upload_tmp_dir in the php. ini configuration file was not properly processed.

So Baidu has this: for reference

1. because no temporary file for upload is set in php. ini, the default address is the temporary file address of the system.

2. if you do not have the permission to read the temporary file directory of the system, the above error will occur.

The solution is to remove the semicolon before upload_tmp_dir and set the temporary file directory.

3. for Windows systems, all parent folders in the temporary folder must have the "list folder directories" permission for "IUSR _ ***** (Internet guest account, we recommend that you create this temporary folder in the PHP directory.

Second: When compressing the front-end css file today, I found that the file cannot be compressed, and the program and permissions are correct. then I checked it out because php. the configuration of the disable_function of ini causes an error when exec compression is executed!

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.

Errors: ajax image upload error and exec error first...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.