In this guide, we'll look at how we can upgrade our PHP version from 8.1 to 8.3
Check your current PHP Version using php -v
root@vmi685053:~# php -v
PHP 8.1.24 (cli) (built: Oct 6 2023 09:46:19) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.24, Copyright (c) Zend Technologies
with Zend OPcache v8.1.24, Copyright (c), by Zend Technologies
On line 2 of the output, we can see that we are running PHP 8.1
# Update repositories list
apt update
# Install Dependencies
apt -y install php8.3 php8.3-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip} mariadb-server nginx tar unzip git
Now if we run php -v
we'll see that we have upgraded to php 8.3
root@vmi685053:~# php -v
PHP 8.3.12 (cli) (built: Sep 27 2024 03:52:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.12, Copyright (c) Zend Technologies
with Zend OPcache v8.3.12, Copyright (c), by Zend Technologies
If you still see php 8.1, try to reboot your machine and delete the previous php version in folder /etc/php
nano /etc/nginx/sites-available/wemx.conf
Change
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
to
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
Now restart Nginx
systemctl restart nginx