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 Reading – How 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.
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
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
sudo nano /etc/php/7.0/apache2/php.ini
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.
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-D
sudo service apache2 restart
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
Hope this tutorial helps you to solve your problem. If you face any trouble, then please let me know by commenting below.