Skip to content

Commit 2ca2ff5

Browse files
authored
Revert "Update php.md" (#1695)
1 parent a0225ec commit 2ca2ff5

File tree

1 file changed

+73
-168
lines changed

1 file changed

+73
-168
lines changed

docs/guides/web/php.md

Lines changed: 73 additions & 168 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, Joseph Brinkman
5-
tested_with: 8.9, 9.3
4+
contributors: Steven Spencer, Ganna Zhyrnova
5+
tested_with: 8.9
66
tags:
77
- web
88
- php
@@ -11,7 +11,11 @@ tags:
1111

1212
# PHP and PHP-FPM
1313

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, ...).
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, ...).
1519

1620
**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.
1721

@@ -39,85 +43,47 @@ Rocky Linux, like its upstream, offers many versions of the language. Some of th
3943

4044
To obtain a list of available versions, simply enter the following command:
4145

42-
=== "9.0"
43-
44-
```bash { .sh data-copy="sudo dnf module list php" }
45-
$ sudo dnf module list php
46-
47-
Rocky Linux 9 - AppStream
48-
Name Stream Profiles Summary
49-
php 8.1 [d] common [d], devel, minimal
50-
51-
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
52-
```
53-
54-
The Remi repository offers more recent releases of PHP than the Appstream repository, including versions 8.2 and 8.3.
55-
56-
To install the Remi repository, run the following command:
57-
58-
```bash
59-
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
60-
```
61-
62-
Once the Remi repository is installed, enable it by running the following command.
63-
64-
```bash
65-
sudo dnf config-manager --set-enabled remi
66-
```
67-
68-
You can now activate a newer module (PHP 8.3) by entering the following command:
69-
70-
```bash
71-
sudo dnf module enable php:8.3
72-
```
73-
74-
=== "8.9"
75-
76-
Rocky Linux, like its upstream, offers many versions of the language. Some of them have reached the end of their life but are kept to continue hosting historical applications that are not yet compatible with new versions of PHP. Please refer to the [supported versions](https://www.php.net/supported-versions.php) page of the php.net website to choose a supported version.
77-
78-
To obtain a list of available versions, simply enter the following command:
79-
80-
```bash { .sh data-copy="sudo dnf module list php" }
81-
$ sudo dnf module list php
82-
83-
Rocky Linux 8 - AppStream
84-
Name Stream Profiles Summary
85-
php 7.2 [d] common [d], devel, minimal PHP scripting language
86-
php 7.3 common [d], devel, minimal PHP scripting language
87-
php 7.4 common [d], devel, minimal PHP scripting language
88-
php 8.0 common [d], devel, minimal PHP scripting language
89-
90-
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
91-
```
92-
93-
Rocky provides, from its AppStream repository, different PHP modules.
94-
95-
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.
96-
97-
You can activate a newer module by entering the following command:
98-
99-
```bash { .sh data-copy="sudo dnf module enable php:8.0" }
100-
sudo dnf module enable php:8.0
101-
==============================================================================================
102-
Package Architecture Version Repository Size
103-
==============================================================================================
104-
Enabling module streams:
105-
httpd 2.4
106-
nginx 1.14
107-
php 8.0
108-
109-
Transaction Summary
110-
==============================================================================================
111-
112-
Is this ok [y/N]:
113-
114-
Transaction Summary
115-
==============================================================================================
116-
117-
Is this ok [y/N]: y
118-
Complete!
119-
```
120-
46+
```bash
47+
$ sudo dnf module list php
48+
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
55+
56+
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
57+
```
58+
59+
Rocky provides, from its AppStream repository, different PHP modules.
60+
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.
62+
63+
You can activate a newer module by entering the following command:
64+
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
74+
75+
Transaction Summary
76+
==============================================================================================
77+
78+
Is this ok [y/N]:
79+
80+
Transaction Summary
81+
==============================================================================================
82+
83+
Is this ok [y/N]: y
84+
Complete!
85+
```
86+
12187
You can now proceed to the installation of the PHP engine.
12288

12389
## PHP cgi mode
@@ -130,58 +96,19 @@ The installation of PHP is relatively trivial, since it consists of installing t
13096

13197
The example below installs PHP with the modules usually installed with it.
13298

133-
!!! Note
134-
135-
To avoid installing weak dependencies such as php-fpm use the following flag with dnf `--setopt=install_weak_deps=false`
136-
13799
```bash
138-
sudo dnf install php php-cli php-gd php-curl php-zip php-mbstring php-mysqlnd
139-
```
140-
141-
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:
142-
143-
```bash
144-
Extra Packages for Enterprise Linux 9 - x86_64
145-
Importing GPG key 0x3228467C:
146-
Userid : "Fedora (epel9) <[email protected]>"
147-
Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C
148-
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
149-
Is this ok [y/N]: y
150-
Key imported successfully
151-
Remi's RPM repository for Enterprise Linux 9 - x86_64
152-
Importing GPG key 0x478F8947:
153-
Userid : "Remi's RPM repository (https://rpms.remirepo.net/) <[email protected]>"
154-
Fingerprint: B1AB F71E 14C9 D748 97E1 98A8 B195 27F1 478F 8947
155-
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el9
156-
Is this ok [y/N]: y
157-
Key imported successfully
158-
Running transaction check
159-
Transaction check succeeded.
160-
Running transaction test
161-
Transaction test succeeded.
162-
163-
Complete!
100+
sudo dnf install php php-cli php-gd php-curl php-zip php-mbstring
164101
```
165102

166103
You can check that the installed version corresponds to the expected one:
167104

168-
=== "9.0"
169-
```bash { .sh data-copy="php -v" }
170-
$ php -v
171-
PHP 8.3.2 (cli) (built: Jan 16 2024 13:46:41) (NTS gcc x86_64)
172-
Copyright (c) The PHP Group
173-
Zend Engine v4.3.2, Copyright (c) Zend Technologies
174-
with Zend OPcache v8.3.2, Copyright (c), by Zend Technologies
175-
```
176-
177-
=== "8.9"
178-
```bash { .sh data-copy="php -v" }
179-
$ php -v
180-
PHP 7.4.19 (cli) (built: May 4 2021 11:06:37) ( NTS )
181-
Copyright (c) The PHP Group
182-
Zend Engine v3.4.0, Copyright (c) Zend Technologies
183-
with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies
184-
```
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+
```
185112

186113
### Configuration
187114

@@ -198,20 +125,15 @@ sudo dnf install httpd
198125
* Activation:
199126

200127
```bash
201-
sudo systemctl enable --now httpd
202-
```
203-
204-
```bash { .sh data-copy="sudo systemctl status httpd" }
205-
$ sudo systemctl status httpd
128+
sudo systemctl enable httpd
129+
sudo systemctl start httpd
130+
sudo systemctl status httpd
206131
```
207132

208133
* Don't forget to configure the firewall:
209134

210135
```bash
211136
sudo firewall-cmd --add-service=http --permanent
212-
```
213-
214-
```bash
215137
sudo firewall-cmd --reload
216138
```
217139

@@ -246,11 +168,9 @@ sudo dnf install php-fpm
246168
As php-fpm is a service from a system point of view, it must be activated and started:
247169

248170
```bash
249-
sudo systemctl enable --now php-fpm
250-
```
251-
252-
```bash { .sh data-copy="sudo systemctl status php-fpm" }
253-
$ sudo systemctl status php-fpm
171+
sudo systemctl enable php-fpm
172+
sudo systemctl start php-fpm
173+
sudo systemctl status php-fpm
254174
```
255175

256176
### Configuration
@@ -269,7 +189,7 @@ daemonize = yes
269189

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

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

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

@@ -366,38 +286,23 @@ PHP-FPM offers, like Apache and its `mod_status` module, a page indicating the s
366286
To activate the page, setup its access path via the `pm.status_path` directive:
367287

368288
```bash
369-
pm.status_path = /fpm-status
370-
```
371-
372-
You must also add the following vhost to your apache configuration file in /etc/httpd/httpd.conf
373-
374-
```bash
375-
<LocationMatch "/fpm-status">
376-
Require local
377-
ProxyPass "unix:/var/run/php-fpm/www.sock|fcgi://localhost/"
378-
</LocationMatch>
379-
```
380-
381-
After editing the php and apache conf files you will need to restart php-fpm and httpd before the changes take place.
382-
383-
```bash
384-
sudo systemctl restart php-fpm && sudo systemctl restart httpd
289+
pm.status_path = /status
385290
```
386291

387292
```bash
388-
curl http://localhost/fpm-status
293+
$ curl http://localhost/status_php
389294
pool: www
390295
process manager: dynamic
391-
start time: 25/Jan/2024:19:30:59 +0000
392-
start since: 18447
393-
accepted conn: 10
296+
start time: 03/Dec/2021:14:00:00 +0100
297+
start since: 600
298+
accepted conn: 548
394299
listen queue: 0
395-
max listen queue: 0
396-
listen queue len: 0
397-
idle processes: 4
398-
active processes: 1
300+
max listen queue: 15
301+
listen queue len: 128
302+
idle processes: 3
303+
active processes: 3
399304
total processes: 5
400-
max active processes: 1
305+
max active processes: 5
401306
max children reached: 0
402307
slow requests: 0
403308
```

0 commit comments

Comments
 (0)