4

How To Install PHP 7.x on Fedora 33/32/31/30/29/28

 2 years ago
source link: https://computingforgeeks.com/how-to-install-php-on-fedora/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

To Install PHP on Fedora 33/32/31/30/29/28, you need to add Remi repository to your system. PHP 7.x is available for installation on any Fedora Linux system. PHP is a popular general-purpose scripting language that is especially suited to web development. It was originally created by Rasmus Lerdorf in 1994.

Install PHP 7.x on Fedora 33/32/31/30/29

It is recommended to install the latest version available on the default Fedora RPM repositories. The version you’ll get varies from one Linux distribution to another. If you need a version of PHP not available on the upstream repositories, consider using third party repositories such as Remi.

sudo dnf -y install php  php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

Confirm PHP version.

$ php -v
PHP 7.3.4 (cli) (built: Apr  2 2019 13:48:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies

Install PHP on Fedora using Remi repository

For any other version of PHP not in default system repositories, add the Remi repository as shown in the next sections.

Update your Fedora system.

sudo dnf -y update

Add Remi repository to Fedora 33:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-33.rpm

Add Remi repository to Fedora 32:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-32.rpm

Add Remi repository to Fedora 31:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-31.rpm

Add Remi repository to Fedora 30:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-30.rpm

Add Remi repository to Fedora 29:

sudo dnf install -y  http://rpms.remirepo.net/fedora/remi-release-29.rpm

Add Remi repository to Fedora 28:

sudo dnf -y install http://rpms.remirepo.net/fedora/remi-release-28.rpm

Once the repository is installed, enable the one with the version of PHP you need. See below example:

sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --set-enabled remi-php74
sudo dnf config-manager --set-enabled remi

Then you can use remi-7.x stream to install PHP.

sudo dnf module install php:remi-7.4

Install PHP extensions using the name format php-<extension>. Example:

sudo dnf install php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

You should now have PHP 7.x installed on Fedora:

$ php -v
PHP 7.4.x (cli) (built: May  16 2020 13:55:51) ( NTS )
Copyright (c) 1997-2020 The PHP Group
Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies

The default PHP configuration file is etc/php.ini. For Nginx web server, use PHP-FPM (FastCGI Process Manager) configuration file to set CGI settings /etc/php-fpm.d/www.conf

When PHP settings are modified, you may need to restart your Web server.

# Nginx
sudo systemctl restart nginx

# Apache
sudo systemctl restart httpd

PHP 7.x has been installed successfully on Fedora 33/32/31/30/29/28 Linux machine. Enjoy PHP Development and have a great time.

PHP Web Programming Video Courses:

Check other Fedora articles:

How to Install FFmpeg on Fedora

How to Install TeamViewer on Fedora

Install AnyDesk on Fedora


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK