Increase WordPress File Upload Size Limit on Google Cloud Platform

1 3,786

Sometimes you might be facing difficulties when trying to upload a file/plugin/theme to your WordPress site on Google Cloud. This problem usually happens due to default “upload_max_filesize” limits, which are imposed in your server’s php.ini file section.

In our WordPress php.ini file section maximum allowed size for files upload is 40MB in by default. So if your file size is bigger than its default limit then WordPress will show a message like this – The uploaded file exceeds the upload_max_filesize directive in php.ini. That’s why we need to increase our WordPress file upload size limit on GCP.

Suggested ReadingHow to Remove Bitnami Banner From WordPress On Google Cloud

So, In this tutorial, I’ll show you how to increase wordpress maximum upload file size limit on Google Cloud platform.

So, Let’s Started

Steps to Increase WordPress File Upload Size Limit on GCP

There are many ways we can fix this upload_max_filesize issue but, I recommend you to troubleshoot this problem by editing our servers php.ini file. So follow my steps below to get started –

Connect to the server using SSH

Step 1: Log in to your Google Cloud Console dashboard and then go to VM Instances.

Steps to Navigate VM instances Page on Google Cloud Console
Steps to Navigate VM instances Page on Google Cloud Console

Step 2: At the VM Instances page, you will see the SSH option. Now simply click on the SSH button to connect with your WordPress installation.

Switch to Root User

Step 3: Once you connected server console using SSH, Enter the command sudo-i to switch as the root user. Next, enter the path to your php.ini file. The location of your php.ini file depends on your website configuration (check below).

If you’re using Bitnami version of WordPress then your php.ini file will be located at –

sudo nano /opt/bitnami/php/etc/php.ini

Or, If you’re using Click to Deploy version of WordPress, then your php.ini file will be located at –

sudo nano /etc/php/7.0/apache2/php.ini
Increase WordPress File Upload Size Limit on Google Cloud Platform 1

Change Upload File Size Limit

Step 4: Once you reach your php.ini file section, type Ctrl+W to search for upload_max_filesize.

Step 5: After locating upload_max_filesize, change the existing value as you want and then press CTRL+X, then enter Y to save the changes and to exit.

Change the default upload_max_filesize limit on Bitnami WordPress

Restart Your Server

After making changes to the file, you will need to restart your server for changes to take effect. Your restart command depends on your website configuration (see below).

If you’re using Bitnami WordPress, then enter the following comment to restart your server.

sudo /opt/bitnami/ctlscript.sh restart apache

If you’re using Click-to-Deploy WordPress, then enter the following comment to restart your server.

sudo service apache2 restart

Optional Modifications

Here are some default limits that you may be wanted to change. You can change their default values as you wish. The process will be the same as above.

  • memory_limit = 128mb
  • upload_max_filesize = 40mb
  • post_max_size = 40mb
  • max_execution_time = 120

That’s it

Hope this tutorial helps you to solve your problem. If you face any trouble, then please let me know by commenting below.

Subscribe to our newsletter
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time
1 Comment
  1. Ashish says

    Hi, when i try to find the max file size with cnt x it propts you’re asking to leave the page. any help would be appreciated.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More