Having difficulty uploading files/plugins/themes to your WordPress website on Google Cloud Platform? This problem usually arises from file upload-size limits, which are imposed in your server’s php.ini file.

Although there are many ways to fix this problem, the best solution is to edit your server’s php.ini file directly – which is what you will learn in this tutorial.

Get Started

  • 1. Connect to VM Instance
  • 2. Switch to Root User
  • 3. Change upload size limit
  • 4. Restart Apache

1. Connect to VM Instance

increase file upload size wordpress on google cloud
Connect to your WordPress VM instance at Compute Engine > VM instances > SSH.

2. Switch to Root User

increase file upload size wordpress on google cloud
Enter the command sudo-i to run commands as root user. Next, enter the path to your php.ini file. The location of your php.ini file depends on your website configuration (see below).

If you’re using Bitnami WordPress, your php.ini file is located at:

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

If you’re using Click-to-Deploy WordPress, your php.ini file is located at:

sudo nano /etc/php/7.0/apache2/php.ini

If you’re using the old Click-to-deploy stack with PHP5 (not PHP7), the php.ini file is located at the following location: sudo nano /etc/php5/apache2/php.ini

3. Change Upload Size Limit

increase file upload size wordpress on google cloud
Now that you’ve opened your php.ini file, use Ctrl + W to search for upload_max_filesize.
increase file upload size wordpress on google cloud
After locating upload_max_filesize, change the existing value to between 40-128M. Then type Ctrl + o to save changes, then Ctrl + x to exit.

4. Restart Apache

linux commands with examples restart apache server bitnami
After making changes to the file, you will need to restart your Apache server for changes to take effect. Your restart command depends on your website configuration (see below).

If you’re using Bitnami WordPress, restart your server by running:

sudo /opt/bitnami/ctlscript.sh restart apache

If you’re using Click-to-Deploy WordPress, restart your server by running:

sudo service apache2 restart

Optional Modifications

Some additional limits that you may want increase are:

  • memory_limit = 64M
  • upload_max_filesize = 64M
  • post_max_size = 64M
  • max_execution_time = 300

If you plan on importing large theme files, you may have to increase the upload size limit to over 128M.