简体   繁体   中英

Changes to upload_max_filesize in Amazon Linux AMI php.ini will not take effect

No matter what I seem to do on my php.ini file to adjust the upload file size, my WordPress size won't change from 2MB.

I've installed WordPress myself on the instance following some AWS tutorials.

Here's what I have done so far:

Create a PHP file in the Apache document root Verified the loaded php.ini files location PHP version 7.2.11

Loaded Configuration File:         /etc/php.ini

Scan for additional .ini files in: /etc/php.d

Additional .ini files parsed:

/etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
/etc/php.d/20-ctype.ini,
/etc/php.d/20-curl.ini,
/etc/php.d/20-exif.ini,
/etc/php.d/20-fileinfo.ini,
/etc/php.d/20-ftp.ini,
/etc/php.d/20-gettext.ini,
/etc/php.d/20-iconv.ini,
/etc/php.d/20-json.ini,
/etc/php.d/20-mysqlnd.ini,
/etc/php.d/20-pdo.ini,
/etc/php.d/20-phar.ini,
/etc/php.d/20-sockets.ini,
/etc/php.d/20-sqlite3.ini,
/etc/php.d/20-tokenizer.ini,
/etc/php.d/30-mysqli.ini,
/etc/php.d/30-pdo_mysql.ini,
/etc/php.d/30-pdo_sqlite.ini

There are several other ini files parsed but on my Amazon Linux AMI instance, there is only one php.ini file

I use Sudo nano php.ini in the /etc directory

; Maximum allowed size for uploaded files.
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

Save. No errors.

Sudo service httpd restart

Look at my phpinfo.php page

It's showing 2MB WordPress confirms the max upload size is 2MB

I have tried editing my .htaccess file but it seems to blow up my site if I add in solutions I've found regarding file upload size at the .htaccess file.

I have tried editing the wp-config.php file as well. Same result Seems to blow up the site.

I have full access to the instance. I can and have saved the php.ini

It should work but simply does not.

Could it be that PHP 7x deals with this differently?

Same here! With same config, I even created a new file on /etc called zzz.ini where only put the same variables as you set up. After that:

sudo systemctl httpd restart

no errors... and the php --ini

Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
/etc/php.d/20-ctype.ini,
/etc/php.d/20-curl.ini,
/etc/php.d/20-dom.ini,
/etc/php.d/20-exif.ini,
/etc/php.d/20-fileinfo.ini,
/etc/php.d/20-ftp.ini,
/etc/php.d/20-gd.ini,
/etc/php.d/20-gettext.ini,
/etc/php.d/20-iconv.ini,
/etc/php.d/20-json.ini,
/etc/php.d/20-mbstring.ini,
/etc/php.d/20-mysqlnd.ini,
/etc/php.d/20-pdo.ini,
/etc/php.d/20-phar.ini,
/etc/php.d/20-simplexml.ini,
/etc/php.d/20-sockets.ini,
/etc/php.d/20-sqlite3.ini,
/etc/php.d/20-tokenizer.ini,
/etc/php.d/20-xml.ini,
/etc/php.d/20-xmlwriter.ini,
/etc/php.d/20-xsl.ini,
/etc/php.d/30-mysqli.ini,
/etc/php.d/30-pdo_mysql.ini,
/etc/php.d/30-pdo_sqlite.ini,
/etc/php.d/30-wddx.ini,
/etc/php.d/30-xmlreader.ini,
/etc/php.d/zzz.ini

zzz.ini content:

post_max_size = 20M
upload_max_filesize = 20M

but on phpinfo() still gettinf max_upload_size = 2M ...

I had the same problem and fixed it by doing a few things:

First create a file sudo nano /etc/php.d/zzz.ini

Inside add the following:

upload_max_filesize=64M
post_max_size=64M
max_execution_time=100

Then the important command is: sudo service php-fpm restart

On most EC2 machines I use for clients usually a: sudo service httpd restart is enough but for some reason here it wasn't working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM