1.php.ini attribute default value
file_uploads = on; switch whether to allow HTTP file upload. The default is ON
upload_tmp_dir; files uploaded to the local store temporary files on the server, the default is the default system temporary folder
upload_max_filesize: allow maximum upload file size. The default is 2M
post_max_size: refers to the maximum value that can be received by the PHP to form POST, in form including all values. The default is 8M
the max_execution_time: maximum time for each run PHP page (s), default 30 seconds
max_input_time: PHP required for each page of the maximum time to receive data, default 60 seconds
to (refer to)
the max_execution_time = 600
max_input_time directives in = 600
the file_uploads ON =
the upload_tmp_dir = / tmp
the upload_max_filesize = 32M
post_max_size = 32M
2. Configure php.ini
You can restart the Apache server
Centos (7 +) / Linux under
1. Looking php.ini
Create a php file using the phpinfo () function to find the location php.ini
echo phpinfo();
Figure:
2. Use Xshell connect to the server, vi edit files
# vi /etc/php.ini
3. Go to the file, the search key (see the beginning, you can modify as you want)
1) In command mode (press ESC to enter, no response, typing the command can be) under knock slash (/) 2) the status bar (bottom left of the screen) appears keyword Enter "/" Enter you want to find.
3) If you want to continue to look for this keyword, knock character n / knock character N (uppercase N) will forward the query;
4. Modify,
The following is a part of the operation command in the command mode
operating | Resolve |
---|---|
i | Text to enter edit mode |
Esc | Exit Edit Text mode |
:w | Preserve the current modification without exiting |
:q | Does not save the file and exit vi |
:wq | Save the current changes and exit vi |
:q! | Do not save the file, force quit vi |
:e! | Discard all changes, starting from the last saved the file to edit |
Needs to be restarted after 5.php.ini modify Apache server (the Internet is said to restart PHP, I attempt failed after a successful restart Apache)
1) PHP start and stop reboot command
service php-fpm start
service php-fpm stop
service php-fpm reload
2) Apache start stop and restart commands
service httpd start start
service httpd restart to restart the
service httpd stop stop service
6. Check the attached file upload cause of failure
$ _FILES [ 'file'] [ 'error'] shows that the file uploaded error code
- Value: 0; no error occurred, the file uploaded successfully.
- Value: 1; The uploaded file exceeds the upload_max_filesize in php.ini option to limit the value of.
- Value: 2; upload file size exceeds the value of the HTML form MAX_FILE_SIZE option specified.
- Value: 3; file was only partially uploaded.
- Value: 4; No file was uploaded.