Php environment file Upload solution _ PHP Tutorial

Source: Internet
Author: User
Tags http file upload
The php environment cannot upload files. 1. check the website directory permissions. Whether the upload Directory has write permission. 2. in the php. ini configuration file php. ini, the following items affect the upload: whether file_uploads is enabled on must be enabled 1. check the website directory permissions.

Whether the upload Directory has write permission.

II. php. ini configuration file
In php. ini, the following operations affect upload:

File_uploads must be enabled if on is enabled

Whether HTTP File upload is allowed

Post_max_size = 8 M

The maximum length of POST data received by PHP. This setting also affects file upload.
To upload a large file, the value must be greater than "upload_max_filesize"
If the memory limit is activated in the configuration script, "memory_limit" also affects file upload.
Generally, "memory_limit" should be larger than "post_max_size.

Upload_max_filesize = 2 M

Maximum size of the file to be uploaded

Upload_tmp_dir = C: \ windows \ temp
Temporary directory for storing files during File upload. It must be a PHP process User-writable directory. If this parameter is not specified, PHP uses the default value.

Default_socket_timeout = 60
Socket timeout, in seconds

Max_execution_time = 30
The maximum execution time of each script, measured in seconds. The default value is 30 seconds.
This parameter helps prevent bad scripts from occupying server resources endlessly.
Note: "max_execution_time" only affects the running time of the script.
Any other time spent outside script running, such as using the system ()/sleep () function, database query, and file upload, is not included.
In safe mode, you cannot use ini_set () to change this setting at runtime.

Max_input_time = 60
Maximum allowed time (POST, GET, upload) for each script to receive input data, measured in seconds

Memory_limit = 128 M
Sets the maximum number of memory bytes that a script can apply.
This helps prevent poor scripts from consuming all the memory on the server.
To use this command, it must be activated during compilation.
Therefore, the configure row should include: -- enable-memory-limit
If you do not need any memory restrictions, you must set it to-1.
Since php4.3.2, when memory_limit is set, the memory_get_usage () function will become available.

3. upload_tmp_dir directory permission
If php configuration is correct, the problem may be caused by the Directory permission set by upload_tmp_dir. In addition to full control, add IIS_WPG permissions, users read and write permissions, and network server permissions.

4. if ZEND is used, check whether ZendOptimizer. MemoryBase @ SYSTEM andZendOptimizer. MemoryBase @ NETWORKSERVICE. if not, create it.

5. if none of the above conditions are met, the problem may occur here. check whether the guests guest Group is disabled in the windows directory and grant the read and execute permissions to the users group in the windows directory.

Check the website directory permissions. Whether the upload Directory has write permission. 2. in the php. ini configuration file php. ini, the following items affect the upload: whether file_uploads is enabled on must be enabled...

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.