Home >Backend Development >PHP Problem >What should I do if php images cannot be uploaded?
Solution to the problem that php images cannot be uploaded: 1. Turn on "file_uploads" and determine the upload size; 2. Modify the value of "memory_limit" to be greater than the value of "post_max_size"; 3. Set the maximum allowed execution of each script Time is enough.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
There are several ways in which the PHP environment cannot upload images Solution
php.ini configuration file (the following points)
1. Whether file_uploads is turned on. It must be turned on whether to allow HTTP file uploads; determine the upload size post_max_size = 8M (server Terminal)
2. The maximum length of POST data accepted by PHP (client) To upload large files, the value must be greater than "upload_max_filesize". If memory limit is activated in the configuration script, "memory_limit" will also affect file upload. .
Generally speaking, "memory_limit" should be larger than "post_max_size". The maximum size of uploaded files upload_max_filesize = 1204KB
3. The maximum allowed execution time of each script, measured in seconds Parameters help prevent low-quality scripts from endlessly hogging 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. The maximum allowed time for each script to receive input data (POST, GET, upload), set in seconds. The maximum number of memory bytes that can be applied for. This helps prevent bad scripts from consuming all the memory on the server. To use this directive, it must be enabled at compile time.
[Recommended learning: PHP video tutorial]
The above is the detailed content of What should I do if php images cannot be uploaded?. For more information, please follow other related articles on the PHP Chinese website!