I have a LEMP stack (Linux, Nginx, MySQL, and PHP) droplet in which i am running a wordpress website. I have got recommendation to upgrade my php version to php 7.3. So, how can i do it in the right way? Also i want to install bcmath and imagick module. It will be very helpful if you describe it in detail step by step. ** Thanks in advance! :)**
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
If you are using nginx after upgrading php you also need to change the directive in nginx’s default configuration file:
vi /etc/nginx/sites-available/default
Find the line:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
And change it accordingly (7.3 in this example):
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
Otherwise nginx will still use the old version.
Upgrade to php7.3
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y php7.3
Check php version
php -v
I hope this helps
Hi there @iamhimanshusrivastava,
You should be able to install Php 7.3 by running the following commands:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.3
Installing most of the common Php packages can be achieved by using:
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
You can then restart Php & Nginx with the following:
sudo systemctl restart nginx.service
sudo systemctl restart php7.3-fpm
Once that is done, nginx should be using php 7.3 - You can verify this by creating a new php file at the root of your website with the following contents:
<?php
phpinfo();
You can then access this file in a browser to confirm that the correct version of php is running.
Hope that helps! - Matt.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
