Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot change upload_max_filesize or post_max_size in php.ini

Bear in mind, I am no sysadmin, I am just a developer. I cannot find anyone with the exact problem as me, just similar, and none of their "fixes" seem to work.

I am currently running an Amazon EC2 instance running.

CentOS 6.2
Nginx 1.2.2
PHP 5.3.16 with APC
Percona 5.5.24 // not currently using this as I am using an RDS

I have set my php.ini (/etc/php.ini) settings to the following

upload_max_filesize=10M
post_max_filesize=20M

After reloading the config, using php -i via ssh, these settings seemed to be loaded. Showing upload_max_filesize=10M, etc.

When using phpinfo() or ini_get, both options are returned as 4M

phpinfo() indicates that the file I am editing is the one loaded (/etc/php.ini).

I have also run php -i | grep "\.ini" to check which files are loaded, and there are no unnecessary loaded configs. I even went through each loaded file individually to check they didn't have the settings inside.

Additionally, I have been suggested to try using a .user.ini config file. This did not change the values either.

ini_set() does not work either.

I'm at a bit of a loss.

EDIT: not sure this will help, but I am using this AMI http://megumi-cloud.com/

like image 880
Matt Edmonston Avatar asked Nov 07 '12 15:11

Matt Edmonston


People also ask

How do you fix the setting for Post_max_size is smaller than upload_max_filesize?

Navigate to your php. Locate the upload_max_filesize and increase it by changing its number. You can also boost a few other limitations, as shown below: upload_max_filesize = 256M post_max_size = 256M memory_limit = 512M max_execution_time = 180. Save the file, and that's it. The error should no longer occur.

How do you fix the uploaded file exceeds the upload_max_filesize directive in PHP ini localhost?

If you left click on the WAMP icon in the status bar, select the PHP menu and then click on the php. ini file in that menu. Just open it in Notepad is fine. Then in Notepad, do a search (CTRL+F) for "upload_max_filesize", and then you can change the value that is set there.

How do you fix the uploaded file exceeds the upload_max_filesize?

In order to fix this error, you need to increase the file size upload limit. That is, you need to increase the value of the upload_max_filesize directive in your php. ini file.


1 Answers

Filename:

nginx/sites-available/default

Add:

location ~ \.php$ {
      fastcgi_param PHP_VALUE "upload_max_filesize = 50M \n post_max_size=51M";
}

Run: From command line: sudo service nginx restart

like image 88
Rupesh Kumar Avatar answered Sep 21 '22 15:09

Rupesh Kumar