About Me

I have decades of experience is software development using .Net Technologies, PHP and wordpress. I love coding and discovering new tech.

Blog

Increasing WordPress File Upload Size by Updating php.ini File for PHP-FPM on Nginx Server

Linux, Nginx, Wordpress

Increasing WordPress File Upload Size by Updating php.ini File for PHP-FPM on Nginx Server

Posted on April 3, 2024  - By Kaustav Halder - 0 Comments

Many WordPress users encounter frustration when trying to upload large files to their websites, only to find that they exceed the default file upload size limit. However, fear not! There’s a straightforward solution to this problem: updating the php.ini file for PHP-FPM on an Nginx server.

In this guide, we’ll walk you through the process of increasing the WordPress file upload size step by step. By following these instructions, you’ll be able to adjust the upload limit to accommodate larger files, allowing you to upload media files, themes, and plugins with ease.

Step 1: Locate the php.ini File

Firstly, you’ll need to locate the php.ini file on your server. This file contains various PHP settings, including the upload file size limit. The location of the php.ini file may vary depending on your server configuration. Common locations include:

  • /etc/php/8.x/fpm/php.ini
  • /etc/php/8.x/cli/php.ini

Note: Replace “8.x” with the version of PHP installed on your server.

Step 2: Edit the php.ini File

Once you’ve located the php.ini file, you’ll need to edit it using a text editor of your choice. You can use nano, vi, or any other text editor installed on your server. For example, to edit the php.ini file using nano, you can use the following command:

sudo nano /etc/php/8.x/fpm/php.ini

Note: Replace “8.x” with the version of PHP installed on your server.

Step 3: Increase the Upload File Size Limit

In the php.ini file, search for the following directives:

upload_max_filesize
post_max_size

These directives control the maximum size of files that can be uploaded via PHP. By default, they are typically set to 2MB or 8MB, which may not be sufficient for your needs.

To increase the upload file size limit, you can modify these directives to your desired value. For example, to set the maximum upload file size to 100MB, you would update the directives as follows:

upload_max_filesize = 100M
post_max_size = 100M

Step 4: Save and Exit

Once you’ve made the necessary changes, save the php.ini file and exit the text editor. If you’re using nano, you can save the changes by pressing Ctrl + X, Followed by ‘Y’, then press Enter to confirm,

Step 5: Restart PHP-FPM and Nginx

To apply the changes, you’ll need to restart PHP-FPM and Nginx. You can do this using the following commands:

sudo service php8.x-fpm restart
sudo service nginx restart

Note: Replace “8.x” with the version of PHP installed on your server.

Conclusion

By following these steps, you can increase the WordPress file upload size by updating the php.ini file for PHP-FPM on an Nginx server. With a larger upload file size limit, you’ll have more flexibility when uploading media files, themes, and plugins to your WordPress website. This simple adjustment can significantly enhance your WordPress experience and streamline your workflow.



About Kaustav

I have decades of experience is software development using .Net Technologies, PHP and wordpress. I love coding and discovering new tech.


0 Comments

Be the first to comment


Leave a reply

Leave a Reply

Your email address will not be published. Required fields are marked *