How to upgrade php to 7.3 or newer on Ubunto WordPress Application

Introduction:

Vultr’s One-Click WordPress application let’s you quickly setup a WordPress application but it can become tricky when trying to update your php to 7.3 or a newer if you’re new to Server Administration. This article will guide you on How to upgrade php to 7.3 or newer. The steps and methods discuss here are particular to the vultr WordPress One Click Application.

Note: Backup your entire WordPress site including your database.

Create a snapshot of your server, this snapshot will be use to restore your server to its initial state should anything go out of your control. To learn about snapshots visit here https://www.vultr.com/docs/cloning-a-virtual-server-with-vultr

Step 1: Connect to your Sever via SSH or using the Vultr console

Access your server using the console. If you are not sure how to connect to your server, use this links below as your guide.

https://www.vultr.com/docs/how-to-access-your-vultr-vps

https://www.vultr.com/docs/connecting-to-your-server-with-ssh-via-putty-on-windows

Read Also on: Safety Check Protection Introduce on Google’s latest Pixel

Step 2: Update OS Packages

Update the Ubuntu OS packages to the latest version:

apt update && apt upgrade

Step 3: Remove old Php version and dependencies

Before installing the new version of php, first, remove the old version and update the server

1st Step:-sudo apt-get remove –purge php*

2nd Step:-sudo apt-get purge php*

3rs Step:-sudo apt-get autoremove

4th Step:-sudo apt-get autoclean

5th Step:-sudo apt-get dist-upgrade

Read Also on: YouTube auto deletes Chinese comment that contains this keywords

How to upgrade php to 7.3 or newer

Step 3: Install php 7.3

Install PHP 7.3 with the following commands

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.3

Verify PHP 7.3 is installed correctly on your server, use the command below:

php –v or sudo php –v
 

Step 4: Install php 7.3 Dependencies and packages

sudo apt-get install php7.3-fpm php7.3-cli php7.3-mysql php7.3-gd php7.3-imagick php7.3-recode php7.3-tidy php7.3-xmlrpc

Note: If you’re trying out this article on a different version of php, be sure to change the version number.

Step 5: Configuring Php 7.3 to listen for nginx

By Default php 7.3 is configured to listen for request from the nginx server using a unix socket unix:/var/run/php7.2-fpm.sock

Open the www.conf file

nano ../etc/php/7.3/fpm/pool.d/www.conf

Look for the line that says listen = and change its value to 127.0.0.1:900

listen = 127.0.0.1:9000

Hint: To search, use Command (Ctrl) + W on your keyboard and type the keyword you wish to search for, in this case, type listen and press enter.

Save your new configuration

Command (Ctrl) + O

Press Command (Ctrl) + X to exit the editor

Step 6: Restart Php and Nginx

sudo systemctl restart nginx.service
sudo systemctl restart php7.3-fpm

If everything was done correctly, following the steps in this article, your site should be back online. Head over to the browser and load your site and be sure everything is working fine.

Step 7: Fixing Write Permission

Access the admin area of your site, try updating or installing a new plugin and see if everything goes well, if no errors appear, we are done else if you get the message

file could not be moved to wp-content/uploads

Then your server has run into an issue with writing permission but not to worry, this is an easy fix,

Grant permission to PHP to write in this folder

sudo adduser root www-data

sudo chown -R www-data:www-data /var/www/html

reload nginx and php Visit your website health and verify your site is now running php 7.3

Leave a Comment

%d bloggers like this: