Bitnami Update PHP Version For WordPress On AWS Lightsail

Update PHP Bitnami Wordpress
  • Home
  • /
  • Blog
  • /
  • Bitnami Update PHP Version For WordPress On AWS Lightsail

Written by Jared Mitcham

For the past few years, I've used an AWS Lightsail WordPress setup for my personal websites. It's a very affordable option for hosting WordPress at only $3.50/month on the cheapest plans. However, it does come with some challenges. 

One recent challenge was updating the PHP version on my Bitnami WordPress instance. Most hosting services offer an option to easily update PHP versions with a click of a button. But Lightsail's Bitnami WordPress instance is not so simple.

The process of upgrading the PHP version on a Bitnami WordPress website hosted on AWS Lightsail goes as follows:

  1. Backup Your Current Website
  2. Deploy A New Bitnami WordPress Instance
  3. Update Your DNS Records
  4. Install SSL certificate on new Bitnami WordPress Instance
  5. Modify The PHP.ini  File To Increase Upload Size
  6. Import Backed Up Website On New Bitnami WordPress Website

In the rest of this article, I'm going to explain the steps to upgrade Bitnami WordPress PHP version. I am writing this because I couldn't find a lot of helpful blog posts on the topic. So I'm adding my own instructions based on my recent experience.

Unfortunately, if you have a unique situation and these instructions don't work for you, I'm not able to offer individual help. However, I do encourage you to leave comments about the problems you have and updates once you've figured out the solution. This will help others who experience similar problems.

Steps To Upgrade PHP Version on Bitnami WordPress Instance Hosted on AWS Lightsail

Looking back, I wish I had video recorded the process of upgrading the PHP version in Bitnami's WordPress. But unfortunately, I didn't do that. So in the rest of this article, my goal will be to make it as clear as possible for anyone struggling to do the same.

Step 1: Create a backup of your existing Website Using All-in-One WP Migration

All-In-One WP Migration To Back Bitnami WordPress

The first step in upgrading PHP versions on a Bitnami WordPress website on AWS Lightsail is to back up your current website. I recommend using a plugin called All-In-One WP Migration. In this article, I'm going to demonstrate the process using All-In-One WP Migration, so I'd encourage you to use this plugin. Simply go to the plugin's settings and click on "Create Backup".

Create a backup using All-In-One WP Migration

It will take several minutes to create a backup. Once it is finished, take note of the size of the download (for example, my backup was about 800MB). You'll need this for a later step.

Step 2: Deploy A New Bitnami WordPress Instance

Unlike other hosts, you can't just upgrade PHP versions on Lightsail with the click of a button. Instead, you have to create a new instance altogether and then transfer your existing website to the new instance.

So the next step to upgrade PHP on your Bitnami WordPress instance is to create a new Bitnami WordPress instance on AWS Lightsail. 

During the first step, you'll need to login into Lightsail on AWS. 

Click button to create Lightsail instance

On the next page, you'll be asked to select the type of instance you want. Select Linux/Unit as your platform. Then select "Wordpress" as your blueprint. Then you'll select the instance plan you'd like to use. Next you'll click on "Create Instance" at the top of the page. Finally, give your instance a name and click "Create Instance".

AWS Lightsail options for creating Bitnami WordPress Instance

You'll need to wait a few minutes for your Bitnami WordPress instance to launch. Then you'll be ready to move on to the next step.

Step 3: Update Your DNS records

The DNS records are what points your domain name to the new server. I host all my websites using a domain name purchased from GoDaddy. For this step, you'll need to login to your domain name provider website and update the value of your A record from your old server to your new server. 

NOTE: As a commenter noticed, Lightsail includes a free static IP address. Therefore, as long as you attach the static IP address to your new instance, you won't need to update the IP address in your DNS records.

To get the IP address of your new server, you'll look at the instance that was created and copy the IP address. It will follow a similar format to the number below.

How to find Lightsail IP Address

Once you've located the new IP address for your Bitnami WordPress instance on AWS Lightsail, go to your domain name provider and update your DNS records so that the A record now points to your new server.

NOTE: If you use a content delivery network, your DNS records won't be managed on your domain name registrar's website, but on your CDN settings dashboard.

update DNS record

Allow some time to pass before moving to the next step. You'll know you're ready to move on when you can type in your web address and you are taken to the new WordPress website. The new WordPress website will have the starter website without any of your existing content.

Step 4: Add An SSL Certificate To Your New Website

Now that your DNS records have been updated and you are seeing your new WordPress server show up when you type in your website address, you are ready to add an SSL certificate to your new website.

The first thing you'll do is open the SSH terminal so that you can run some code on the server. Click on the orange square in the upper right hand side of your instance.

How to open SSH terminal on WordPress Bitnami on AWS Lightsail

You can also click on your instance and then click on "Connect Using SSH" to open their browser-based terminal.

Connect Using SSH button

Once you are logged into the terminal window, you can run a script that installs a free Let's Encrypt SSL certificate onto your website. It also runs a script that automatically renews the SSL certificate every so often.

Just in case the instructions are updated by Bitnami, I'll include a link to their official documents for this step, but I'll also provide the script below.

sudo /opt/bitnami/bncert-tool

Once you run this script, you'll be asked several questions. You will most likely select all of the default options. When asked to list your domains, it's important that you enter both the www version of your website and the non-www version of your website. 

Once the script has finished, it will ask you to restart your server for the changes to take effect. Give it a few minutes and visit your website again. This time you should see a lock icon indicating the website is secure.

ssl certificate icon

Step 5: Update the PHP.INI file

You are almost done updating PHP versions on your Bitnami WordPress website. You now have a new WordPress website with the newest PHP version. However, you don't have your website content added to the website. You simply have a basic default WordPress website at this point.

But before you import the file you exported in step 1 of this tutorial, you'll need to modify your PHP.INI file so that it will allow large uploads. For the original instructions from Bitnami you can click here, but I'll add the steps below as well.

In my case, the exported file was about 800 MB in size. However, the default size that the server will allow you to upload is 16 MB. So you'll need to change this or the import will fail.

First, login to your Lightsail terminal similar to the previous step. Once you are logged in, edit the PHP.INI file by typing the following command:

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

Once the file has opened in the editor, you will find the lines of code that allow you to change the default values. Look for the lines that say "Maximum size of POST data that PHP will access" and "Maximum allowed size for uploaded files". 

; Maximum size of POST data that PHP will accept.
post_max_size = 16M

; Maximum allowed size for uploaded files.
upload_max_filesize = 16M

Change the default values from 16M to a size that is big enough to allow you to upload your file from step 1. In my case, I needed to change the size to 900M. 

To edit the file following my instructions you'll need to:

  1. Hit "i" on your keyboard to enter "insert" mode.
  2. Edit the file to update the sizes.
  3. Hit the "escape" key to exit "insert" mode.
  4. Type ":wq" to save your changes and exit.
; Maximum size of POST data that PHP will accept.
post_max_size = 900M

; Maximum allowed size for uploaded files.
upload_max_filesize = 900M

Once the file is saved, you must restart the server by using the script below.

sudo /opt/bitnami/ctlscript.sh restart

Step 6: Import Your Previous Website Data

You exported your website data in step 1. Now that you have your new website up and it's running the updated version of PHP, it's time for you to import your saved website data onto your new server. 

First, you'll need to login to your new Bitnami wordpress website. To do this, you'll need the default username and password.

If you are still logged into the Lightsail terminal, you can type the following command to get your password:

cat bitnami_application_password

The default user for a Bitnami wordpress website is "user". Visit www.yourwebsite.com/wp-admin to sign in. I recommend immediately creating a new user for yourself and deleting the default user information for security purposes.

Once you are logged in, go to the All-In-One WP Migration plugin settings and click on "Import". If you've modified the PHP.INI file properly, you will see the maximum upload file shows the modified size that you created in the previous step.

import data using all-in-on wp migration

Click "Import From" and select "file". Then upload the file you exported in step 1. Once the import is done, you can visit your website and see your original content.

You are now done updating your PHP version on your Bitnami WordPress instance on AWS Lightsail. I hope that this tutorial was helpful and clear enough to get the job done quickly. Feel free to leave a comment if you found this tutorial helpful or if you ran into any problems during the process of updating PHP version on your Bitnami WordPress version.


Leave A Comment

  • This helped a lot, thanks! A couple things that tripped me up.
    1. After scrolling through the long PHP.Ini to find those entries I didn’t realize you had to hit ‘i’ to insert and edit file.
    2. Also didn’t know how to find the default username and password to new instance for WordPress so that we could then upload old WordPress backup with migration. Found those commands here – https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-quick-start-guide-wordpress

  • Hi Jared, I’ve been using this procedure in the past, but now All In One WP Migration gives me this error message: the “restore might fail because you are restoring to a different version of PHP”. When I press OK to proceed it actually crashes. Any ideas?

  • Will this work with Woocommerce? I am facing an issue as Woocommerce will not run on my current PHP version. AWS Lightsail…

    • Hi Brian, I’m not sure why it wouldn’t work with WooCommerce. This process should carry over your plugins to your new site, so would imagine it would work. However, I didn’t do this on a website with woocommerce installed. If you follow these steps, please let us know how it went so that others can know.

  • This was great. Unfortunately the WP did not pick up the old url in the settings and defaulted to the IP Address. It didn’t let me change it in the settings as it was greyed out, so I ‘hacked’ in the site URL. The site URL displays as http://www.url, even though that is not what I entered in the wp-ini file. Somewhere www. was added. This kills my WP SES Lite email as now it tries to send from [email protected]. On the plus side, all of my products, orders, and customers came over. Astra is choking and has ‘dropped’ some photos from my site. I seem to be able to add them back without issue. I have reverted back to my old site as after 7.9 hours, I can’t sufficiently hack my email into working.

    • Hi Brian, sorry to hear about that. Were you able to get this figured out? My first thought was to ask if you followed the steps in the exact order. If I were troubleshooting, I would review the steps of adding your SSL certificate, but I really don’t know why that may have happened. Let me know if you got it figured out.

    • Hi Ramesh! I’m not sure how to help you in this case as I’ve never experienced it personally. I hope you are able to find the answer. If so, please give us an update later in case anyone else has this same issues.

  • On Lightsail you should create a static IP address in which case the DNS update step is not needed. If you don’t create and use a static IP your instance IP could change by simply reboot.

    In Lightsail click Networking and Create Static IP then assign it to your instance.

    • Thanks for the advice. You are right about the static IP. In my case, I didn’t want to pay for the static IP. I found that the IP address wasn’t getting changed upon reboot.

      • For every instance there is a static IP address for free. So you don’t pay anything extra when you create a static ip for an existing instance.

        • Hi Hans! Thanks for the info. I didn’t realize this was true, but you are right. You don’t get charged for a static IP for your lightsail instance as long as you are using us. Thanks for contributing.

  • I use Lightsail too. But I learned that the throughput ceiling is set so low (4%) that just having 2 people poking around on my site and it will go over and the website will become unresponsive. is that the situation for you too?

    • Hey Howard, that’s a great question. I haven’t noticed any problems with performance, but this makes me want to do more research. Thanks for commenting with your thoughts.

  • Excellent writeup.

    I use static IPs, and the process for switching one from the old instance to the new instance is simple:

    1) From Lightsail home go to Networking tab
    2) Click hamburger icon of the static IP used on the old site, and click Manage
    3) Click detatch
    4) Attach to the new instance

  • This was a lifesaver. I tried updating the ini and wp-config settings but obvs the php.ini was overriding them. Thanks for this!

  • I did this but now non of my urls are working. Before the I changed the DNS it was all fine, now when i click links it gets stuck

    • Sorry to hear that you are having trouble. Were you able to get it working? My first thought would be to ask if followed every step in order, but I’m sure you probably did.

  • You totally saved me! This tutorial is well written and everything worked exactly as you described. Thank you!

  • When using route 53 for DNS, I had to update my A/AAAA/NS records to match the new lightsail instance. If you don’t do NS, SSL will fail.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Read More Articles:

    Chess Board Setup: A Complete Guide for Beginners

    >