Install LAMP Stack on Rocky Linux 9

0
972
Install LAMP Stack on Rocky Linux 9
Install LAMP Stack on Rocky Linux 9

This guide will take you through how to install LAMP Stack on Rocky Linux 9. LAMP is an acronym for Linux, Apache, MariaDB/MySQL, and PHP. It is used to power websites and online applications. Each component has a particular application for which it can be utilized.

Table of Contents

- Advertisement -

Install Apache on Rocky Linux 9

Run the following command to install Apache.

sudo dnf install httpd

Sample output

Last metadata expiration check: 0:31:17 ago on Sat 16 Jul 2022 06:47:18 PM EAT.
Dependencies resolved.
========================================================================
 Package              Arch      Version              Repository    Size
========================================================================
Installing:
 httpd                x86_64    2.4.51-7.el9_0       appstream    1.4 M
Installing dependencies:
 apr                  x86_64    1.7.0-11.el9         appstream    123 k
 apr-util             x86_64    1.6.1-20.el9         appstream     94 k
 apr-util-bdb         x86_64    1.6.1-20.el9         appstream     13 k
 httpd-filesystem     noarch    2.4.51-7.el9_0       appstream     14 k
 httpd-tools          x86_64    2.4.51-7.el9_0       appstream     81 k
 rocky-logos-httpd    noarch    90.11-1.el9          appstream     24 k
Installing weak dependencies:
 apr-util-openssl     x86_64    1.6.1-20.el9         appstream     15 k
 mod_http2            x86_64    1.15.19-2.el9        appstream    149 k
 mod_lua              x86_64    2.4.51-7.el9_0       appstream     61 k

Transaction Summary
========================================================================
Install  10 Packages

Total download size: 1.9 M
Installed size: 5.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/10): rocky-logos-httpd-90.11-1.el9.n  25 kB/s |  24 kB     00:00    
(2/10): mod_lua-2.4.51-7.el9_0.x86_64.r  54 kB/s |  61 kB     00:01    
(3/10): httpd-tools-2.4.51-7.el9_0.x86_  59 kB/s |  81 kB     00:01    
(4/10): httpd-filesystem-2.4.51-7.el9_0  44 kB/s |  14 kB     00:00    
(5/10): apr-util-openssl-1.6.1-20.el9.x  67 kB/s |  15 kB     00:00    
(6/10): apr-util-bdb-1.6.1-20.el9.x86_6  48 kB/s |  13 kB     00:00    
(7/10): apr-util-1.6.1-20.el9.x86_64.rp 169 kB/s |  94 kB     00:00    
(8/10): mod_http2-1.15.19-2.el9.x86_64. 168 kB/s | 149 kB     00:00    
(9/10): apr-1.7.0-11.el9.x86_64.rpm      83 kB/s | 123 kB     00:01    
(10/10): httpd-2.4.51-7.el9_0.x86_64.rp  76 kB/s | 1.4 MB     00:18    
------------------------------------------------------------------------
Total                                    83 kB/s | 1.9 MB     00:23     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                1/1 
  Installing       : apr-1.7.0-11.el9.x86_64                       1/10 
  Installing       : apr-util-bdb-1.6.1-20.el9.x86_64              2/10 
  Installing       : apr-util-1.6.1-20.el9.x86_64                  3/10 
  Installing       : apr-util-openssl-1.6.1-20.el9.x86_64          4/10 
  Installing       : httpd-tools-2.4.51-7.el9_0.x86_64             5/10 
  Running scriptlet: httpd-filesystem-2.4.51-7.el9_0.noarch        6/10 
useradd warning: apache's uid 48 outside of the SYS_UID_MIN 201 and SYS_UID_MAX 999 range.

  Installing       : httpd-filesystem-2.4.51-7.el9_0.noarch        6/10 
  Installing       : rocky-logos-httpd-90.11-1.el9.noarch          7/10 
  Installing       : mod_lua-2.4.51-7.el9_0.x86_64                 8/10 
  Installing       : mod_http2-1.15.19-2.el9.x86_64                9/10 
  Installing       : httpd-2.4.51-7.el9_0.x86_64                  10/10 
  Running scriptlet: httpd-2.4.51-7.el9_0.x86_64                  10/10 
  Verifying        : rocky-logos-httpd-90.11-1.el9.noarch          1/10 
  Verifying        : mod_lua-2.4.51-7.el9_0.x86_64                 2/10 
  Verifying        : httpd-tools-2.4.51-7.el9_0.x86_64             3/10 
  Verifying        : httpd-2.4.51-7.el9_0.x86_64                   4/10 
  Verifying        : httpd-filesystem-2.4.51-7.el9_0.noarch        5/10 
  Verifying        : apr-util-openssl-1.6.1-20.el9.x86_64          6/10 
  Verifying        : apr-util-bdb-1.6.1-20.el9.x86_64              7/10 
  Verifying        : apr-util-1.6.1-20.el9.x86_64                  8/10 
  Verifying        : mod_http2-1.15.19-2.el9.x86_64                9/10 
  Verifying        : apr-1.7.0-11.el9.x86_64                      10/10 

Installed:
  apr-1.7.0-11.el9.x86_64                                               
  apr-util-1.6.1-20.el9.x86_64                                          
  apr-util-bdb-1.6.1-20.el9.x86_64                                      
  apr-util-openssl-1.6.1-20.el9.x86_64                                  
  httpd-2.4.51-7.el9_0.x86_64                                           
  httpd-filesystem-2.4.51-7.el9_0.noarch                                
  httpd-tools-2.4.51-7.el9_0.x86_64                                     
  mod_http2-1.15.19-2.el9.x86_64                                        
  mod_lua-2.4.51-7.el9_0.x86_64                                         
  rocky-logos-httpd-90.11-1.el9.noarch                                  

Complete!

Next, enable and start Apache using the following command.

sudo systemctl enable httpd --now

Confirm Apache is running by checking its status.

sudo systemctl status httpd

Sample output

● httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2022-07-16 19:20:48 EAT; 51s ago
       Docs: man:httpd.service(8)
   Main PID: 32782 (httpd)
     Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec"
      Tasks: 213 (limit: 23272)
     Memory: 22.9M
        CPU: 156ms
     CGroup: /system.slice/httpd.service
             ├─32782 /usr/sbin/httpd -DFOREGROUND
             ├─32783 /usr/sbin/httpd -DFOREGROUND
             ├─32784 /usr/sbin/httpd -DFOREGROUND
             ├─32785 /usr/sbin/httpd -DFOREGROUND
             └─32786 /usr/sbin/httpd -DFOREGROUND

Jul 16 19:20:48 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Jul 16 19:20:48 localhost.localdomain httpd[32782]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to>
Jul 16 19:20:48 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Jul 16 19:20:48 localhost.localdomain httpd[32782]: Server configured, listening on: port 80

You can also check the Apache test page if it’s working by entering your domain name or IP address on the browser.

Configure Firewall to work with HTTPD

Allow port 80 on the firewall using the command below.

sudo firewall-cmd --permanent --zone=public --add-service=http

Next, allow port 443 on the firewall using the following command.

sudo firewall-cmd --permanent --zone=public --add-service=https

Reload your firewall to apply changes.

sudo firewall-cmd --reload

Install MariaDB on Rocky Linux 9

Run the command below to install MariaDB.

sudo dnf install mariadb-server mariadb

Sample output

Dependencies resolved.
=======================================================================
 Package                     Arch    Version          Repository  Size
=======================================================================
Installing:
 mariadb                     x86_64  3:10.5.13-2.el9  appstream  1.6 M
 mariadb-server              x86_64  3:10.5.13-2.el9  appstream  9.3 M
Installing dependencies:
 mariadb-common              x86_64  3:10.5.13-2.el9  appstream   32 k
 mariadb-connector-c         x86_64  3.2.6-1.el9_0    appstream  195 k
 mariadb-connector-c-config  noarch  3.2.6-1.el9_0    appstream  9.8 k
 mariadb-errmsg              x86_64  3:10.5.13-2.el9  appstream  188 k
 mysql-selinux               noarch  1.0.4-2.el9      appstream   35 k
 perl-DBD-MariaDB            x86_64  1.21-16.el9_0    appstream  151 k
 perl-File-Copy              noarch  2.34-479.el9     appstream   29 k
 perl-Sys-Hostname           x86_64  1.23-479.el9     appstream   26 k
Installing weak dependencies:
 mariadb-backup              x86_64  3:10.5.13-2.el9  appstream  6.4 M
 mariadb-gssapi-server       x86_64  3:10.5.13-2.el9  appstream   20 k
 mariadb-server-utils        x86_64  3:10.5.13-2.el9  appstream  211 k

Transaction Summary
=======================================================================
Install  13 Packages

Total download size: 18 M
Installed size: 107 M
Is this ok [y/N]: y
Downloading Packages:
(1/13): mariadb-connector-c-config-3.2  11 kB/s | 9.8 kB     00:00    
(2/13): perl-Sys-Hostname-1.23-479.el9  27 kB/s |  26 kB     00:00    
(3/13): mysql-selinux-1.0.4-2.el9.noar  18 kB/s |  35 kB     00:01    
(4/13): perl-File-Copy-2.34-479.el9.no  18 kB/s |  29 kB     00:01    
(5/13): mariadb-connector-c-3.2.6-1.el  41 kB/s | 195 kB     00:04    
(6/13): mariadb-gssapi-server-10.5.13-  57 kB/s |  20 kB     00:00    
(7/13): mariadb-server-utils-10.5.13-2  62 kB/s | 211 kB     00:03    
(8/13): mariadb-common-10.5.13-2.el9.x 115 kB/s |  32 kB     00:00    
(9/13): mariadb-errmsg-10.5.13-2.el9.x 181 kB/s | 188 kB     00:01    
(10/13): mariadb-10.5.13-2.el9.x86_64. 167 kB/s | 1.6 MB     00:09    
(11/13): perl-DBD-MariaDB-1.21-16.el9_  49 kB/s | 151 kB     00:03    
(12/13): mariadb-backup-10.5.13-2.el9. 142 kB/s | 6.4 MB     00:45    
(13/13): mariadb-server-10.5.13-2.el9. 152 kB/s | 9.3 MB     01:02    
-----------------------------------------------------------------------
Total                                  272 kB/s |  18 MB     01:08     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                               1/1 
  Installing       : mariadb-connector-c-config-3.2.6-1.el9_0.    1/13 
  Installing       : mariadb-common-3:10.5.13-2.el9.x86_64        2/13 
  Installing       : mariadb-connector-c-3.2.6-1.el9_0.x86_64     3/13 
  Installing       : perl-Sys-Hostname-1.23-479.el9.x86_64        4/13 
  Installing       : perl-DBD-MariaDB-1.21-16.el9_0.x86_64        5/13 
  Installing       : mariadb-errmsg-3:10.5.13-2.el9.x86_64        6/13 
  Installing       : perl-File-Copy-2.34-479.el9.noarch           7/13 
  Running scriptlet: mysql-selinux-1.0.4-2.el9.noarch             8/13 
  Installing       : mysql-selinux-1.0.4-2.el9.noarch             8/13 
  Running scriptlet: mysql-selinux-1.0.4-2.el9.noarch             8/13 
libsemanage.semanage_direct_install_info: Overriding mysql module at lower priority 100 with module at priority 200.

  Installing       : mariadb-server-utils-3:10.5.13-2.el9.x86_    9/13 
  Installing       : mariadb-gssapi-server-3:10.5.13-2.el9.x86   10/13 
  Installing       : mariadb-backup-3:10.5.13-2.el9.x86_64       11/13 
  Installing       : mariadb-3:10.5.13-2.el9.x86_64              12/13 
  Running scriptlet: mariadb-server-3:10.5.13-2.el9.x86_64       13/13 
  Installing       : mariadb-server-3:10.5.13-2.el9.x86_64       13/13 
  Running scriptlet: mariadb-server-3:10.5.13-2.el9.x86_64       13/13 
  Running scriptlet: mysql-selinux-1.0.4-2.el9.noarch            13/13 
  Running scriptlet: mariadb-server-3:10.5.13-2.el9.x86_64       13/13 
  Verifying        : mysql-selinux-1.0.4-2.el9.noarch             1/13 
  Verifying        : mariadb-connector-c-3.2.6-1.el9_0.x86_64     2/13 
  Verifying        : mariadb-connector-c-config-3.2.6-1.el9_0.    3/13 
  Verifying        : perl-Sys-Hostname-1.23-479.el9.x86_64        4/13 
  Verifying        : perl-File-Copy-2.34-479.el9.noarch           5/13 
  Verifying        : mariadb-server-utils-3:10.5.13-2.el9.x86_    6/13 
  Verifying        : mariadb-server-3:10.5.13-2.el9.x86_64        7/13 
  Verifying        : mariadb-gssapi-server-3:10.5.13-2.el9.x86    8/13 
  Verifying        : mariadb-errmsg-3:10.5.13-2.el9.x86_64        9/13 
  Verifying        : mariadb-common-3:10.5.13-2.el9.x86_64       10/13 
  Verifying        : mariadb-backup-3:10.5.13-2.el9.x86_64       11/13 
  Verifying        : mariadb-3:10.5.13-2.el9.x86_64              12/13 
  Verifying        : perl-DBD-MariaDB-1.21-16.el9_0.x86_64       13/13 

Installed:
  mariadb-3:10.5.13-2.el9.x86_64                                       
  mariadb-backup-3:10.5.13-2.el9.x86_64                                
  mariadb-common-3:10.5.13-2.el9.x86_64                                
  mariadb-connector-c-3.2.6-1.el9_0.x86_64                             
  mariadb-connector-c-config-3.2.6-1.el9_0.noarch                      
  mariadb-errmsg-3:10.5.13-2.el9.x86_64                                
  mariadb-gssapi-server-3:10.5.13-2.el9.x86_64                         
  mariadb-server-3:10.5.13-2.el9.x86_64                                
  mariadb-server-utils-3:10.5.13-2.el9.x86_64                          
  mysql-selinux-1.0.4-2.el9.noarch                                     
  perl-DBD-MariaDB-1.21-16.el9_0.x86_64                                
  perl-File-Copy-2.34-479.el9.noarch                                   
  perl-Sys-Hostname-1.23-479.el9.x86_64                                

Complete!

To check the version of MariaDB installed, run the command below.

mariadb --version

Enable and start MariaDB.

sudo systemctl enable mariadb --now

To check the status of MariaDB, run the following command.

systemctl status mariadb

Sample output

● mariadb.service - MariaDB 10.5 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2022-07-16 19:34:05 EAT; 56s ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 34315 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS)
    Process: 34338 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
    Process: 34436 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS)
   Main PID: 34420 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 15 (limit: 23272)
     Memory: 75.8M
        CPU: 672ms
     CGroup: /system.slice/mariadb.service
             └─34420 /usr/libexec/mariadbd --basedir=/usr

Jul 16 19:34:05 localhost.localdomain mariadb-prepare-db-dir[34378]: See the MariaDB Knowledgebase at https://mariadb.com/kb or the
Jul 16 19:34:05 localhost.localdomain mariadb-prepare-db-dir[34378]: MySQL manual for more instructions.
Jul 16 19:34:05 localhost.localdomain mariadb-prepare-db-dir[34378]: Please report any problems at https://mariadb.org/jira
Jul 16 19:34:05 localhost.localdomain mariadb-prepare-db-dir[34378]: The latest information about MariaDB is available at https://mariadb.org/.
Jul 16 19:34:05 localhost.localdomain mariadb-prepare-db-dir[34378]: You can find additional information about the MySQL part at:
Jul 16 19:34:05 localhost.localdomain mariadb-prepare-db-dir[34378]: https://dev.mysql.com
Jul 16 19:34:05 localhost.localdomain mariadb-prepare-db-dir[34378]: Consider joining MariaDB's strong and vibrant community:
Jul 16 19:34:05 localhost.localdomain mariadb-prepare-db-dir[34378]: https://mariadb.org/get-involved/
Jul 16 19:34:05 localhost.localdomain mariadbd[34420]: 2022-07-16 19:34:05 0 [Note] /usr/libexec/mariadbd (mysqld 10.5.13-MariaDB) starting as process 34420 ...
Jul 16 19:34:05 localhost.localdomain systemd[1]: Started MariaDB 10.5 database server.

Secure MariaDB.

sudo mariadb-secure-installation

Sample output

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] n
 ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Install PHP on Rocky Linux 9

Run the following command to install PHP.

sudo dnf install php php-curl php-zip php-opcache php-mysqlnd

Sample output

Dependencies resolved.
======================================================================
 Package             Arch      Version             Repository    Size
======================================================================
Installing:
 php                 x86_64    8.0.13-1.el9        appstream     14 k
 php-common          x86_64    8.0.13-1.el9        appstream    667 k
 php-mysqlnd         x86_64    8.0.13-1.el9        appstream    154 k
 php-opcache         x86_64    8.0.13-1.el9        appstream    511 k
 php-pecl-zip        x86_64    1.19.2-6.el9        appstream     54 k
Installing dependencies:
 libzip              x86_64    1.7.3-7.el9         appstream     62 k
 nginx-filesystem    noarch    1:1.20.1-10.el9     appstream     11 k
 php-pdo             x86_64    8.0.13-1.el9        appstream     87 k
Installing weak dependencies:
 php-cli             x86_64    8.0.13-1.el9        appstream    3.1 M
 php-fpm             x86_64    8.0.13-1.el9        appstream    1.6 M
 php-mbstring        x86_64    8.0.13-1.el9        appstream    474 k
 php-xml             x86_64    8.0.13-1.el9        appstream    136 k

Transaction Summary
======================================================================
Install  12 Packages

Total download size: 6.8 M
Installed size: 36 M
Is this ok [y/N]: y
Downloading Packages:
(1/12): nginx-filesystem-1.20.1-10.el 5.4 kB/s |  11 kB     00:01    
(2/12): libzip-1.7.3-7.el9.x86_64.rpm  23 kB/s |  62 kB     00:02    
(3/12): php-pecl-zip-1.19.2-6.el9.x86  17 kB/s |  54 kB     00:03    
(4/12): php-pdo-8.0.13-1.el9.x86_64.r 127 kB/s |  87 kB     00:00    
(5/12): php-xml-8.0.13-1.el9.x86_64.r  89 kB/s | 136 kB     00:01    
(6/12): php-mysqlnd-8.0.13-1.el9.x86_ 240 kB/s | 154 kB     00:00    
(7/12): php-mbstring-8.0.13-1.el9.x86 314 kB/s | 474 kB     00:01    
(8/12): php-opcache-8.0.13-1.el9.x86_ 251 kB/s | 511 kB     00:02    
(9/12): php-common-8.0.13-1.el9.x86_6 202 kB/s | 667 kB     00:03    
(10/12): php-fpm-8.0.13-1.el9.x86_64. 301 kB/s | 1.6 MB     00:05    
(11/12): php-8.0.13-1.el9.x86_64.rpm  8.4 kB/s |  14 kB     00:01    
(12/12): php-cli-8.0.13-1.el9.x86_64. 292 kB/s | 3.1 MB     00:10    
----------------------------------------------------------------------
Total                                 404 kB/s | 6.8 MB     00:17     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                              1/1 
  Installing       : php-common-8.0.13-1.el9.x86_64              1/12 
  Installing       : php-pdo-8.0.13-1.el9.x86_64                 2/12 
  Installing       : php-xml-8.0.13-1.el9.x86_64                 3/12 
  Installing       : php-opcache-8.0.13-1.el9.x86_64             4/12 
  Installing       : php-mbstring-8.0.13-1.el9.x86_64            5/12 
  Installing       : php-cli-8.0.13-1.el9.x86_64                 6/12 
  Installing       : libzip-1.7.3-7.el9.x86_64                   7/12 
  Running scriptlet: nginx-filesystem-1:1.20.1-10.el9.noarch     8/12 
  Installing       : nginx-filesystem-1:1.20.1-10.el9.noarch     8/12 
  Installing       : php-fpm-8.0.13-1.el9.x86_64                 9/12 
  Running scriptlet: php-fpm-8.0.13-1.el9.x86_64                 9/12 
  Installing       : php-8.0.13-1.el9.x86_64                    10/12 
  Installing       : php-pecl-zip-1.19.2-6.el9.x86_64           11/12 
  Installing       : php-mysqlnd-8.0.13-1.el9.x86_64            12/12 
  Running scriptlet: php-mysqlnd-8.0.13-1.el9.x86_64            12/12 
  Verifying        : nginx-filesystem-1:1.20.1-10.el9.noarch     1/12 
  Verifying        : libzip-1.7.3-7.el9.x86_64                   2/12 
  Verifying        : php-pecl-zip-1.19.2-6.el9.x86_64            3/12 
  Verifying        : php-xml-8.0.13-1.el9.x86_64                 4/12 
  Verifying        : php-pdo-8.0.13-1.el9.x86_64                 5/12 
  Verifying        : php-opcache-8.0.13-1.el9.x86_64             6/12 
  Verifying        : php-mysqlnd-8.0.13-1.el9.x86_64             7/12 
  Verifying        : php-mbstring-8.0.13-1.el9.x86_64            8/12 
  Verifying        : php-fpm-8.0.13-1.el9.x86_64                 9/12 
  Verifying        : php-common-8.0.13-1.el9.x86_64             10/12 
  Verifying        : php-cli-8.0.13-1.el9.x86_64                11/12 
  Verifying        : php-8.0.13-1.el9.x86_64                    12/12 

Installed:
  libzip-1.7.3-7.el9.x86_64                                           
  nginx-filesystem-1:1.20.1-10.el9.noarch                             
  php-8.0.13-1.el9.x86_64                                             
  php-cli-8.0.13-1.el9.x86_64                                         
  php-common-8.0.13-1.el9.x86_64                                      
  php-fpm-8.0.13-1.el9.x86_64                                         
  php-mbstring-8.0.13-1.el9.x86_64                                    
  php-mysqlnd-8.0.13-1.el9.x86_64                                     
  php-opcache-8.0.13-1.el9.x86_64                                     
  php-pdo-8.0.13-1.el9.x86_64                                         
  php-pecl-zip-1.19.2-6.el9.x86_64                                    
  php-xml-8.0.13-1.el9.x86_64                                         

Complete!

Restart Apache.

sudo systemctl restart httpd

Next, create a test file to confirm PHP is working.

sudo nano /var/www/html/info.php

Enter the code below in the file created above.

<?php
phpinfo();
?>

Then open your browser and enter your domain name or IP address followed by info.php e.g. localhost/info.php or 192.168.5.12/info.php you should be able to see the sample page below.

That marks the end of our guide. Cheers!

Read more on Apache Documentation
Read more on MariaDB Documentation
Read more on PHP Documentation

LEAVE A REPLY

Please enter your comment!
Please enter your name here