Link to home
Start Free TrialLog in
Avatar of sharingsunshine
sharingsunshineFlag for United States of America

asked on

PHP.ini Not Changing Wordpress Upload Size

I need to upload a Wordpress theme and I am getting the message that I am exceeding the max_filesize.  I have change php.in, restarted Apache and still I get the same error.

These are the settings I have changed:

upload_max_filesize=122M
post_max_size=168M
memory_limit=512M
file_uploads = On
max_execution_time=290

Open in new window


Please tell me what to fix.

Thanks,

Randal
Avatar of Pavel Nagaev
Pavel Nagaev
Flag of Russian Federation image

1: Theme Functions File
There are cases where we have seen that just by adding the following code in theme’s functions.php file, you can increase the upload size:

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

2. Create or Edit an existing PHP.INI file
For this method you will need to access your WordPress site’s root folder by using FTP or File Manager app in your hosting account’s cPanel dashboard.

In most cases if you are on a shared host, then you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder. In that file add the following code:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

This method is reported to work for many users. Remember if 64 doesn’t work, then try 10MB (sometimes that work).

3. htaccess Method
Some people have tried using the .htaccess method where by modifying the .htaccess file in the root directory, you can increase the maximum upload size in WordPress. Edit the .htaccess file in your WordPress site’s root folder and add the following code:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

Again, it is important that we emphasize that if you are on a shared hosting package, then these techniques may not work. In that case, you would have to contact your web hosting provider to increase the limit for you.

We hope this article helped you increase the maximum file upload size in WordPress. If you are still having issues, then follow the steps in our WordPress troubleshooting guide to fix it.

https://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/
Hi Randal,

So those should be the right settings. Wordpress only cares about two INI settings: post_max_size and upload_max_filesize, and it will take the lowest of these 2 settings. So in your INI file, the value should be 122 megabytes.

That means that either something is overriding one or both of those values later (e.g. .htaccess or PHP code), or you're modifying the wrong php.ini file.

Try adding a phpinfo file into your Wordpress base directory and then check the values:
<?php
phpinfo();

Open in new window


Check the php.ini path to make sure it's the same one you're modifying, and then check those 2 config values.
Avatar of sharingsunshine

ASKER

I am editing the correct path and the values are showing like this in php_info

https://gyazo.com/c0450ba26e9f395ca3ddf31c01b5a098

This is all I have in .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Open in new window


Something is overriding my settings.  Do you have any idea how to find what it is?
So if those are the values from phpinfo(), then either:
1. Your php.ini file has multiple upload_max_filesize lines and the last one is overwriting the earlier. Search your php.ini file for upload_max_filesize and make sure you only have ONE line that has that value specified.

2. You have an auto_prepend_file that is running and overriding those values (check your php.ini file).

3. You don't have the right php.ini file. I know you said you are editing the correct path, but it wouldn't be the first time that someone thought they were editing the right file and it turned out they weren't. Check the "Loaded Configuration File" line in the phpinfo() output and triple-check the file you're editing. Try making some other changes to the ini file (to other variables), restart the web server, and re-check phpinfo to make sure they changed.
I really appreciate your suggestions and there is only one upload_max_filesize in php.ini

This is what is in there for prepend.  Should I comment them out even though they are blank? Please notice the path in comparison to the php info screenshot.

https://gyazo.com/498c73c23f54b73dc6109aca27b2e167

PHP info - https://gyazo.com/91193f6eb58eae4c4d1387c6a9db8bce
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I had no idea that I had PHP-FPM much less it had to be reloaded when I make a change to php.ini.  Anyway that fixed the problem and I must encourage you to write an article about that because no articles put their finger on that being the issue.
really glad you helped me today.  Thanks again.