Question

How to upgrate PHP 7.4.3 TO PHP 8 on wordpress

How to upgrate PHP 7.4.3 TO PHP 8 on wordpress


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

If you are using Ubuntu, you can use these commands to install PHP 8:

Enable neccessery repository:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Once the PPA is enabled, you can install PHP 8

Now, there are some small differences if you are using Apache or Nginx:

Apache Installing PHP as an Apache module is a straightforward task:

sudo apt update
sudo apt install php8.0 libapache2-mod-php8.0
sudo apt install php8.0-fpm libapache2-mod-fcgid
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.0-fpm

Once the packages are installed, restart Apache for the PHP module to get loaded:

sudo systemctl restart apache2

Nginx

sudo apt update
sudo apt install php8.0-fpm

Once the installation is completed, the FPM service will start automatically. To check the status of the service, run

systemctl status php8.0-fpm

Install PHP extensions Extensions are available as packages and can be easily installed with apt :

sudo apt install php8.0-[extenionName]

Here is a list of the most common extenions you’ll need:

sudo apt install -y php8.0-mysql php8.0-dom php8.0-simplexml php8.0-ssh2 php8.0-xml php8.0-xmlreader php8.0-curl  php8.0-exif  php8.0-ftp php8.0-gd  php8.0-iconv php8.0-imagick php8.0-json  php8.0-mbstring php8.0-posix php8.0-sockets php8.0-tokenizer

Having said that it’s good to have these extensions as well.

sudo apt install -y php8.0-mysqli php8.0-pdo  php8.0-sqlite3 php8.0-ctype php8.0-fileinfo php8.0-zip php8.0-exif

That’s it, you now have PHP8.