Skip to content

Commit 2078bea

Browse files
authored
added 9.3 installation instructions (#1853)
* added 9.3 installation instructions * Made tabs more verbose * Added 1 line of space to fix tab spacing.
1 parent 20455c9 commit 2078bea

File tree

1 file changed

+136
-63
lines changed

1 file changed

+136
-63
lines changed

docs/guides/web/php.md

Lines changed: 136 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: PHP and PHP-FPM
33
author: Antoine Le Morvan
4-
contributors: Steven Spencer, Ganna Zhyrnova
5-
tested_with: 8.9
4+
contributors: Steven Spencer, Ganna Zhyrnova, Joseph Brinkman
5+
tested_with: 9.3, 8.9
66
tags:
77
- web
88
- php
@@ -11,11 +11,7 @@ tags:
1111

1212
# PHP and PHP-FPM
1313

14-
!!! warning "Written for Rocky Linux 8.x"
15-
16-
This procedure was initially published when Rocky Linux 8.x was the only version. This procedure must tested and rewritten for Rocky Linux 9.x.
17-
18-
**PHP** (**P**HP **H**ypertext **P**reprocessor) is a source scripting language, specially designed for web application development. In 2021, PHP represented a little less than 80% of the web pages generated in the world. PHP is open-source and is the core of the most famous CMS (WordPress, Drupal, Joomla!, Magento, ...).
14+
**PHP** (**P**HP **H**ypertext **P**reprocessor) is a source scripting language, specially designed for web application development. In 2024, PHP represented a little less than 80% of the web pages generated in the world. PHP is open-source and is the core of the most famous CMS (WordPress, Drupal, Joomla!, Magento, ...).
1915

2016
**PHP-FPM** (**F**astCGI **P**rocess **M**anager) is integrated to PHP since its version 5.3.3. The FastCGI version of PHP brings additional functionalities.
2117

@@ -43,46 +39,80 @@ Rocky Linux, like its upstream, offers many versions of the language. Some of th
4339

4440
To obtain a list of available versions, simply enter the following command:
4541

46-
```bash
47-
$ sudo dnf module list php
42+
=== "9.3 PHP module list"
4843

49-
Rocky Linux 8 - AppStream
50-
Name Stream Profiles Summary
51-
php 7.2 [d] common [d], devel, minimal PHP scripting language
52-
php 7.3 common [d], devel, minimal PHP scripting language
53-
php 7.4 common [d], devel, minimal PHP scripting language
54-
php 8.0 common [d], devel, minimal PHP scripting language
44+
```bash
45+
$ sudo dnf module list php
5546

56-
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
57-
```
47+
Rocky Linux 9 - AppStream
48+
Name Stream Profiles Summary
49+
php 8.1 [d] common [d], devel, minimal
5850

59-
Rocky provides, from its AppStream repository, different PHP modules.
51+
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
52+
```
6053

61-
You will note that the default version of a Rocky 8.9 is 7.2 that has already reached its end of life at the time of writing.
54+
The Remi repository offers more recent releases of PHP than the Appstream repository, including versions 8.2 and 8.3.
6255

63-
You can activate a newer module by entering the following command:
56+
To install the Remi repository, run the following command:
6457

65-
```bash
66-
sudo dnf module enable php:8.0
67-
==============================================================================================
68-
Package Architecture Version Repository Size
69-
==============================================================================================
70-
Enabling module streams:
71-
httpd 2.4
72-
nginx 1.14
73-
php 8.0
58+
```bash
59+
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
60+
```
7461

75-
Transaction Summary
76-
==============================================================================================
62+
Once the Remi repository is installed, enable it by running the following command.
7763

78-
Is this ok [y/N]:
64+
```bash
65+
sudo dnf config-manager --set-enabled remi
66+
```
7967

80-
Transaction Summary
81-
==============================================================================================
68+
You can now activate a newer module (PHP 8.3) by entering the following command:
8269

83-
Is this ok [y/N]: y
84-
Complete!
85-
```
70+
```bash
71+
sudo dnf module enable php:remi-8.3
72+
```
73+
74+
=== "8.9 PHP module list"
75+
76+
```bash
77+
$ sudo dnf module list php
78+
79+
Rocky Linux 8 - AppStream
80+
Name Stream Profiles Summary
81+
php 7.2 [d] common [d], devel, minimal PHP scripting language
82+
php 7.3 common [d], devel, minimal PHP scripting language
83+
php 7.4 common [d], devel, minimal PHP scripting language
84+
php 8.0 common [d], devel, minimal PHP scripting language
85+
86+
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
87+
```
88+
89+
Rocky provides, from its AppStream repository, different PHP modules.
90+
91+
You will note that the default version of a Rocky 8.9 is 7.2 that has already reached its end of life at the time of writing.
92+
93+
You can activate a newer module by entering the following command:
94+
95+
```bash
96+
sudo dnf module enable php:8.0
97+
==============================================================================================
98+
Package Architecture Version Repository Size
99+
==============================================================================================
100+
Enabling module streams:
101+
httpd 2.4
102+
nginx 1.14
103+
php 8.0
104+
105+
Transaction Summary
106+
==============================================================================================
107+
108+
Is this ok [y/N]:
109+
110+
Transaction Summary
111+
==============================================================================================
112+
113+
Is this ok [y/N]: y
114+
Complete!
115+
```
86116

87117
You can now proceed to the installation of the PHP engine.
88118

@@ -96,19 +126,64 @@ The installation of PHP is relatively trivial, since it consists of installing t
96126

97127
The example below installs PHP with the modules usually installed with it.
98128

99-
```bash
100-
sudo dnf install php php-cli php-gd php-curl php-zip php-mbstring
101-
```
129+
=== "9.3 install PHP"
130+
131+
```bash
132+
sudo dnf install php php-cli php-gd php-curl php-zip php-mbstring
133+
```
134+
135+
During installation you will be prompted to import GPG keys for the epel9 (Extra Packages for Enterprise Linux 9) and Remi repositories, enter y to import the keys:
136+
137+
```bash
138+
Extra Packages for Enterprise Linux 9 - x86_64
139+
Importing GPG key 0x3228467C:
140+
Userid : "Fedora (epel9) <epel@fedoraproject.org>"
141+
Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C
142+
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
143+
Is this ok [y/N]: y
144+
Key imported successfully
145+
Remi's RPM repository for Enterprise Linux 9 - x86_64
146+
Importing GPG key 0x478F8947:
147+
Userid : "Remi's RPM repository (https://rpms.remirepo.net/) <remi@remirepo.net>"
148+
Fingerprint: B1AB F71E 14C9 D748 97E1 98A8 B195 27F1 478F 8947
149+
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el9
150+
Is this ok [y/N]: y
151+
Key imported successfully
152+
Running transaction check
153+
Transaction check succeeded.
154+
Running transaction test
155+
Transaction test succeeded.
156+
157+
Complete!
158+
```
159+
160+
=== "8.9 install PHP"
161+
162+
```bash
163+
sudo dnf install php php-cli php-gd php-curl php-zip php-mbstring
164+
```
102165

103166
You can check that the installed version corresponds to the expected one:
104167

105-
```bash
106-
$ php -v
107-
PHP 7.4.19 (cli) (built: May 4 2021 11:06:37) ( NTS )
108-
Copyright (c) The PHP Group
109-
Zend Engine v3.4.0, Copyright (c) Zend Technologies
110-
with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies
111-
```
168+
=== "9.3 check PHP version"
169+
170+
```bash
171+
$ php -v
172+
PHP 8.3.2 (cli) (built: Jan 16 2024 13:46:41) (NTS gcc x86_64)
173+
Copyright (c) The PHP Group
174+
Zend Engine v4.3.2, Copyright (c) Zend Technologies
175+
with Zend OPcache v8.3.2, Copyright (c), by Zend Technologies
176+
```
177+
178+
=== "8.9 check PHP version"
179+
180+
```bash
181+
$ php -v
182+
PHP 7.4.19 (cli) (built: May 4 2021 11:06:37) ( NTS )
183+
Copyright (c) The PHP Group
184+
Zend Engine v3.4.0, Copyright (c) Zend Technologies
185+
with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies
186+
```
112187

113188
### Configuration
114189

@@ -118,24 +193,23 @@ To serve PHP pages in CGI mode, you must install the apache server, configure it
118193

119194
* Installation:
120195

121-
```bash
122-
sudo dnf install httpd
123-
```
196+
```bash
197+
sudo dnf install httpd
198+
```
124199

125-
* Activation:
200+
* Activation:
126201

127-
```bash
128-
sudo systemctl enable httpd
129-
sudo systemctl start httpd
130-
sudo systemctl status httpd
131-
```
202+
```bash
203+
sudo systemctl enable --now httpd
204+
sudo systemctl status httpd
205+
```
132206

133207
* Don't forget to configure the firewall:
134208

135-
```bash
136-
sudo firewall-cmd --add-service=http --permanent
137-
sudo firewall-cmd --reload
138-
```
209+
```bash
210+
sudo firewall-cmd --add-service=http --permanent
211+
sudo firewall-cmd --reload
212+
```
139213

140214
The default vhost should work out of the box. PHP provides a `phpinfo()` function that generates a summary table of its configuration. It's very useful to test the good working of PHP. However, be careful not to leave such test files on your servers. They represent a huge security risk for your infrastructure.
141215

@@ -168,8 +242,7 @@ sudo dnf install php-fpm
168242
As php-fpm is a service from a system point of view, it must be activated and started:
169243

170244
```bash
171-
sudo systemctl enable php-fpm
172-
sudo systemctl start php-fpm
245+
sudo systemctl enable --now php-fpm
173246
sudo systemctl status php-fpm
174247
```
175248

@@ -189,7 +262,7 @@ daemonize = yes
189262

190263
The php-fpm configuration files are widely commented. Go and have a look!
191264

192-
As you can see, the files in the `/etc/php-fpm/` directory with the `.conf` extension are always included.
265+
As you can see, the files in the `/etc/php-fpm.d/` directory with the `.conf` extension are always included.
193266

194267
By default, a PHP process pool, named `www`, is declared in `/etc/php-fpm.d/www.conf`.
195268

0 commit comments

Comments
 (0)