Question

Wordpress upload file size error even after raising php limits

Hey all, I get ‘The uploaded file exceeds the upload_max_filesize directive in php.ini.’ error while trying to upload a plugin which is just 5.1MB. I have raised the limits in php.ini file and also thru webmin.

This is my php.ini file

 max_input_time = 24000
 max_execution_time = 24000
 upload_max_filesize = 12000M
 post_max_size = 24000M
 memory_limit = 12000M

Here is my nginx.conf file. I have also increased client_max_body_size under server and http.

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
	client_max_body_size 24000M;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;
.........
server_names_hash_bucket_size 128;
	server {
    	client_max_body_size 24000M;
		server_name thesatlight.com www.thesatlight.com;
.....

What could be the problem?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

Hello,

You can create a php info file in order to check the current values and check which is the php.ini file in use. Create the following file in your public_hmtl folder - phpinfo.php and put the following code inside it:

<?php
phpinfo();
?>

You can also use the following command in order to find the location of the php.ini file:

php -i | grep php.ini

The output will be:

Configuration File (php.ini) Path => /etc/php/7.2/cli
Loaded Configuration File => /etc/php/7.2/cli/php.ini

Then check for the current value of uploadmaxfilesize you can also check which is the configuration file - php.ini that is currently used and apply the changes there (if the site using the global php.ini file and you change the values for these settings this will make the changes globally for all sites). Ideally you would like to have the following values:

upload_max_filesize = 64M

You also need to restart your web server in order the changes to take effect.

Hope that this helps! Regards, Alex

@akaab

Edit this file /home/thesatlight/etc/php7.0/php.ini and make sure you have the required values in it also make sure these values are not defined in any file inside this directory /etc/opt/rh/rh-php70/php.d.

Then tell me if the issue is resolved.

@Mohsen47 I have edited the same file. Here is the php info page https://thesatlight.com/info.php

@akaab

Make sure that you are modifying the INI file used by your web server not the one used by PHP CLI.

You can create a PHP file called info.php with the following content

<?php
   phpinfo();
?>

Then open the page in your web browser and make sure the options you changed are applied to the runtime configuration, if they are not applied then try to restart Nginx with this command sudo service nginx restart

Open the page after restart if the values are not applied then you are not modifying the right php.ini file used by your web server.

Hope this helps.