TechAmor
For the Love of Technology
TechAmor
A Multi Technology Portal for Tech Enthusiasts
Your Company Address
India
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
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
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
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
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:
As you can see in the image PHP 7.4 is installed and working correctly.
So, enjoy it.