Installing PHP 7.4 on OpenSUSE 15.1

Installing PHP 7.4 on OpenSUSE 15.1
16th December 2019 No Comments Uncategorised admin

Steps to Install

PHP 7.4 is available to OpenSUSE using an official repository called Devel. This repository in turn contains many tools for programming, such as languages and more. Within this repository there is a special one for PHP. This is the one we will use.

So add it with the following command:

:~$ sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_15.1/ php
1.- Adding the PHP repository for OpenSUSE 15.1
1.- Adding the PHP repository for OpenSUSE 15.1

After it has been added, it sets a lower priority for packages to be downloaded from this repository. Do this with the following command:

:~$ zypper mr -p 70 php
2.- Set a lower priority to the PHP repository
2.- Set a lower priority to the PHP repository

The next step is to refresh all the repositories. When you first use this repository, it will ask you to accept the GPG key.

:~$ sudo zypper refresh
3.- accept the repository GPG key
3.- accept the repository GPG key

Then you can install PHP 7.4 on OpenSUSE 15.1 as well as some of the main PHP modules.

:~$ sudo zypper in php7 php apache2-mod_php7 php7-curl php7-xmlreader php7-zip php7-pdo php7-gd php7-json php7-mysql php7-mbstring php7-openssl
4.- Install PHP 7.4 on OpenSUSE 15.1
4.- Install PHP 7.4 on OpenSUSE 15.1

Now, enable PHP 7 on Apache and restart it.

:~$ sudo a2enmod php7
:~$ sudo systemctl restart apache2

Now, let us test it.

Create a file called test.php in /srv/www/htdocs/ and add the following:

:~$ sudo nano /srv/www/htdocs/test.php
<?php
phpinfo();
?>

Save the changes and close the file.

Then, open your favorite web browser and go to http://your-server/test.php and you will see the following:

5.- PHP 7.4 on OpenSUSE 15.1
5.- PHP 7.4 on OpenSUSE 15.1

As you can see in the image PHP 7.4 is installed and working correctly.

So, enjoy it.

About The Author

Leave a reply

Your email address will not be published. Required fields are marked *