1

I get this error:

"Maximum allowed file size for upload is 2m. Please check your server PHP settings"

Magento ver 1.9.1.0 VPS Linux server with WHM Manager and cPanel access.

Every time I try to upload a file larger then 2M inside Magento it gives me that error. I have added the line php_value upload_max_filesize 10M to both my .htaccess and php.ini files in the public_html folder.

I have gone into WHM and into the configuration editor and changed it to 10mb there. I hop into cPanel and in the PHP Configuration it says its set to 10m, but, when I go to sewchacha.com/phpinfo.php it says that the max upload size is set to 2M.

I have multiple other sites on this server in their own cPanel's and they show the correct 10m with the phpinfo.php file. It is only this site that doesn't show it correctly. Yes I have restarted the server several times after making the changes in the .ini and .htaccess files.

Is there something in Magento that is overriding the server settings?

Am I missing something?

Thank you for your help!

8
  • Is APC in play?
    – user4351
    Commented Mar 14, 2015 at 11:34
  • Have you put a phpinfo() file at the root and checked what the actual value is set to? Some hosts ignore php.ini and htaccess overrides.
    – Jongosi
    Commented Mar 14, 2015 at 13:04
  • Yes, I have the phpinfo.php file in the root right now, and it shows 2mb for the upload_max_filesize when the server shows it set to 10 in both the WHM and cPanel, and the .htaccess file and php.ini files both have it set to 10M in them.
    – Mike
    Commented Mar 14, 2015 at 18:32
  • @Melvyn what it the "APC"?
    – Mike
    Commented Mar 14, 2015 at 18:33
  • @Melvyn (I Figured out what APC was) I do not see APC enabled when I go to the phpinfo.php. I don't see it enabled on my other site either. My other site works fine and shows the correct upload size in its phpinfo.php file.
    – Mike
    Commented Mar 14, 2015 at 18:41

2 Answers 2

3

Disclaimer : On behalf of the OP, turns his comment into an answer

After spending hours on this I checked for the 20th time and the stupid php.ini file had upload_max_filesize 10M and not upload_max_filesize = 10M .

LOL that was the problem, it works now. Thank you for your help!

1

See your PHP Info - create a file called e.g. info.php and add following PHP code to this file:

echo phpinfo();

Run this file on your server and you will see all PHP settings, see upload_max_filesize directive.php info

If there is only 2M (2 MB), you should increase your upload file size in your php.ini.

; Maximum allowed size for uploaded files
upload_max_filesize = 10M

Save your php.ini and restart your server.


Is it not your server? (Just to test)

Try to add the following code to your index.php file (or your main script file):

ini_set('upload_max_filesize', '10M');

Reference here.

3
  • Adding that on my index.php is also not working. Commented Feb 24, 2020 at 11:55
  • @AfreenSheikh add in your pub/index.php Commented Feb 24, 2020 at 14:40
  • Adding it in my pub/index.php also didn't work. Commented Feb 26, 2020 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.