Increase upload file size limit in PHP
Try uploading smaller files
If you are experiencing difficulties uploading even small file sizes, it indicates a general problem with the uploading process. First, check the PHP error logs for any relevant error messages. Additionally, make sure that you have sufficient disk space available. In Linux, you can use the following command to check the available disk space:
By examining these aspects, you can identify and address the underlying issues affecting your file uploads.
If you're able to upload smaller files successfully, but not larger ones, there are a few steps you can take to troubleshoot the issue.
Check your PHP configuration settings
There are directives that determine the maximum size of data that can be uploaded to a server.
upload_max_filesizesets the limit on the size of each individual file that can be uploaded.
post_max_sizesets the limit on the total size of the entire upload request.
Verify that these PHP settings are large enough to accommodate the size of the files you're trying to upload.
The default value for these settings is
2M. If you use the default limits, you'll need to increase them in your PHP configuration file (
; Maximum allowed size for uploaded files. ; https://php.net/upload-max-filesize upload_max_filesize = 10M
; Maximum size of POST data that PHP will accept. ; Its value may be 0 to disable the limit. It is ignored if POST data reading ; is disabled through enable_post_data_reading. ; https://php.net/post-max-size post_max_size = 10M
Please don't forget to restart PHP so that the changes made in the php.ini file can take effect.
If you use Apache:
sudo service apache2 restart
If you use Nginx:
sudo service nginx restart
If you are using the PHP-FPM service, please ensure to restart it as well.
sudo service php-fpm restart
Where can I find
The location of the
php.ini file varies depending on your server configuration and operating system. Here are some common locations where you might find the file:
On Linux systems running Apache, the
php.inifile is typically located in
On Windows systems running Apache, the
php.inifile is typically located in the Apache installation directory, such as
C:\Program Files (x86)\Apache Group\Apache2\.
On Windows systems running IIS, the
php.inifile is typically located in the PHP installation directory, such as
If you're not sure where to find the
php.ini file on your server, you can create a new PHP script with the following code:
<?php phpinfo(); ?>
This script will output a table of information about your PHP configuration, including the location of the
php.ini file. Look for the "Loaded Configuration File" entry to find the path to your php.ini file.
Check your web server settings
You can also check server settings, such as the
memory_limit. Ensure that the settings values are sufficient for the file size you're trying to upload.