2

I am using Easyengine for a WordPress site, and I need to upload a large file to the server, I know I can use FTP / SSH to do so but in the long run I need it to be done via PHP, and the current upload limit that I see is 100M when doing phpinfo();

The setup uses PHP 7 and the PHP INI file that I found is at

etc/php/7.2/php.ini

I made changes to these parts:

upload_max_filesize = 2100M
post_max_size = 2100M

But even after this the upload limit is 100M as I can see on both WordPress plugin page that I am using as well as with phpinfo()

I read somewhere that Nginx needs to be restarted so I did ee site restart example.com and both Nginx and PHP were restarted still no effect.

Some articles suggested adding a rule to /etc/nginx/nginx.conf but unfortunately that path doesn't even exist, so I created that file at that path and tried but still no use.

Deepak Kamat
  • 1,880
  • 4
  • 23
  • 38

3 Answers3

5

To troubleshoot your issue, I'd take the following steps:

  1. Check your php.ini path to check if you're editing the right one

To find your php.ini, create a file called info.php or any other name in your webroot and add the following:

<?php phpinfo();

Now, go to your browser and visit: http:///test.php. On the resulting page search for:

Configuration File (php.ini) Path

That will show you your php.ini location

  1. Check if your PHP script isn't overwriting your settings using ini_set()

  2. Check if your settings aren't overwritten in your pool.d fpm config file.

    In most configurations, it's located at

    /etc/php/*/fpm/pool.d/www.conf

  3. Make sure you restart php-fpm and nginx.

    To do so

    sudo /etc/init.d/php-fpm restart sudo /etc/init.d/nginx restart

Peter
  • 8,776
  • 6
  • 62
  • 95
  • 1
    1. Loaded config file's address is `/usr/local/etc/php/php.ini` but that path is not there on my directory structure, however `etc/php/7.2/php.ini` is the only `ini` file 2. No `ini_set()` in use anywhere. 3. Where is this `pool.d` file? 4. Running `php-fpm` on my SSH brings nothing. I did restart PHP itself. – Deepak Kamat Apr 11 '19 at 08:32
  • @DeepakKamat Sorry for the delayed response. I've edited my answer. – Peter Apr 12 '19 at 07:23
  • You may need to include php version to restart the php-fpm service e.g ```sudo /etc/init.d/php7.4-fpm``` – madamis confidential Jul 31 '22 at 08:46
0

I also faced this kind of issue. I was editing wrong file located at /etc/php/8.0/cli/php.ini instead of correct one. Because nginx uses php-fpm version. So correct file was /etc/php/8.0/fpm/php.ini

And don't forget to kill current fpm process with sudo pkill php-fpm8.0 command. then type sudo service php8.0-fpm to start service normally.

0

The correct syntax for php.ini is post_max_size = 30M, but I write post_max_size: 30M. And this costs me a whole day.

Also, in the phpinfo(), there is Additional .ini files parsed. I'm new to PHP but it seems that these files are overwriting php.ini in the order they are listed. So I create a 99-php.ini file in the same directory, making sure it is the last one in the list.

And also don't forget to restart php-fpm. In my case, I am using ubuntu, so I run sudo systemctl restart php8.1-fpm.

Hope this can save someone's time.

Yan
  • 117
  • 5