简体   繁体   English

在Amazon Linux AMI php.ini中对upload_max_filesize的更改将不会生效

[英]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. 无论我对php.ini文件执行什么操作来调整上传文件的大小,我的WordPress大小都不会从2MB更改。

I've installed WordPress myself on the instance following some AWS tutorials. 我已根据一些AWS教程在实例上自行安装了WordPress。

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 在Apache文档根目录中创建一个PHP文件验证加载的php.ini文件的位置PHP版本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 解析了其他几个ini文件,但是在我的Amazon Linux AMI实例上,只有一个php.ini文件

I use Sudo nano php.ini in the /etc directory 我在/ etc目录中使用Sudo nano php.ini

; 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 看看我的phpinfo.php页面

It's showing 2MB WordPress confirms the max upload size is 2MB 显示2MB WordPress确认最大上传大小为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. 我曾尝试编辑.htaccess文件,但如果我添加了有关.htaccess文件上载文件大小的解决方案,那似乎会使我的网站崩溃。

I have tried editing the wp-config.php file as well. 我也尝试过编辑wp-config.php文件。 Same result Seems to blow up the site. 结果相同似乎炸毁了该网站。

I have full access to the instance. 我拥有对该实例的完全访问权限。 I can and have saved the php.ini 我可以并且已经保存了php.ini

It should work but simply does not. 它应该工作,但根本不行。

Could it be that PHP 7x deals with this differently? 难道PHP 7x对此有不同的处理?

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. 使用相同的配置,我什至在/ etc上创建了一个名为zzz.ini的新文件,其中仅放置与设置相同的变量。 After that: 之后:

sudo systemctl httpd restart

no errors... and the php --ini 没有错误...和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: zzz.ini内容:

post_max_size = 20M
upload_max_filesize = 20M

but on phpinfo() still gettinf max_upload_size = 2M ... 但是在phpinfo()上仍然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 首先创建一个文件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 然后重要的命令是: 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. 在大多数用于客户端的EC2机器上,通常使用以下sudo service httpd restartsudo service httpd restart就足够了,但是由于某种原因,它无法正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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