6 C
Texas
angeloma
Senior Writer and partner

How to install PHP 7.4 on OpenSUSE 15.1?

A new version of PHP has come out and it’s time to install it on our servers. So in this post, you will learn how to install PHP 7.4 on OpenSUSE 15.1. Having this version, you will be able to take better advantage of running websites.

As we know, PHP is a programming language widely used all over the world. In fact, most of the web sites and applications use it. Therefore, it is to be assumed that most servers need it. So it is a good idea to install the latest stable version of it.

We already know that OpenSUSE is a solid and stable rock. But a lot of this is due to the testing process they do on the packages. The problem is that the versions of the packages are frozen and as time goes by they get old.

So, let us start.

Install PHP 7.4 on OpenSUSE 15.1

Installing Apache web server

- Advertisement -

So let’s get to work.

First, I’m going to install Apache web server to have a server to run PHP 7.4 on.

So, open a new terminal session and run the following:

:~$ sudo zypper in apache2

And then we proceed to start the service:

:~$ sudo systemctl enable apache2
:~$ sudo systemctl start apache2

After this, a new rule must be set in the firewall so that it can run without problems.

:~$ sudo firewall-cmd --add-port=80/tcp --permanent
success
:~$ sudo firewall-cmd --reload
success

With this Apache will be working properly.

Installing PHP 7.4

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.

Conclusion

Having PHP 7.4 is a good alternative to improve the performance of our web applications created with this language. And now we know how to do it with OpenSUSE 15.1, what remains is that you can take advantage of all these improvements of the language.

If you want to know all the news of this new version I invite you to read them in this link.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article