Home >Backend Development >PHP Tutorial >Solution to the problem of unable to upload files in PHP environment_PHP tutorial

Solution to the problem of unable to upload files in PHP environment_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:31:36871browse

1. Check the permissions of the website directory.

Whether the upload directory has write permission.

2. php.ini configuration file
The following things in php.ini affect uploading:

file_uploads Whether to turn on must be turned on

Whether to allow HTTP file upload

post_max_size = 8M

The maximum length of POST data accepted by PHP. This setting also affects file uploads.
To upload large files, this value must be greater than "upload_max_filesize"
"memory_limit" will also affect file uploads if memory limit is activated in the configuration script.
Generally speaking, "memory_limit" should be larger than "post_max_size".

upload_max_filesize = 2M

The maximum size of files allowed to be uploaded

upload_tmp_dir = C:windowstemp
The temporary directory where files are stored when uploading files. It must be a directory writable by the PHP process user. If not specified, PHP uses the system default value

default_socket_timeout = 60
socket timeout in seconds

max_execution_time = 30
The maximum allowed execution time of each script, in seconds . The default is 30 seconds.
This parameter helps prevent inferior scripts from endlessly occupying server resources.
Note: "max_execution_time" only affects the running time of the script itself.
Any other time spent outside of script running, such as the use of system()/sleep() functions, database queries, file uploads, etc. are not included.
In safe mode, you cannot use ini_set() to change this setting at runtime

max_input_time = 60
The maximum time allowed for each script to receive input data (POST, GET, upload), In seconds

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

3. Upload_tmp_dir directory permissions
If there is no problem with the PHP configuration, the problem may lie in the directory permissions set by upload_tmp_dir. Add IIS_WPG permissions except full control, users read and write permissions, and NETWORK SERVER permissions except full control.

4. If ZEND is enabled, check if there are ZendOptimizer.MemoryBase@SYSTEM and ZendOptimizer.MemoryBase@NETWORKSERVICE in the Temp folder. If not, create it.

5. If none of the above works, the problem is likely to be here. Check whether the guests group is disabled in the windows directory, and give read and execute permissions to the users group in the windows directory.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/763011.htmlTechArticle1. Check the permissions of the website directory. Whether the upload directory has write permission. 2. php.ini configuration file There are the following things in php.ini that affect uploading: file_uploads is turned on or not. It must be turned on...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn