Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit 8835e5b

Browse files
committed
Add fpm-nginx and fpm-httpd subpackages
1 parent 19abe51 commit 8835e5b

File tree

5 files changed

+104
-44
lines changed

5 files changed

+104
-44
lines changed

httpd-fpm.conf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#
2+
# The following lines prevent .user.ini files from being viewed by Web clients.
3+
#
4+
<Files ".user.ini">
5+
Require all denied
6+
</Files>
7+
8+
#
9+
# Allow php to handle Multiviews
10+
#
11+
AddType text/html .php
12+
13+
#
14+
# Add index.php to the list of files that will be served as directory
15+
# indexes.
16+
#
17+
DirectoryIndex index.php
18+
19+
#
20+
# Redirect to local php-fpm (no mod_php in default configuration)
21+
#
22+
# Enable http authorization headers
23+
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
24+
25+
<FilesMatch \.(php|phar)$>
26+
SetHandler "proxy:fcgi://127.0.0.1:9000"
27+
#SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
28+
</FilesMatch>

nginx-fpm.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
# network or unix domain socket configuration
33

44
upstream php-fpm {
5-
server unix:/run/php-fpm/www.sock;
5+
server 127.0.0.1:9000;
6+
#server unix:/run/php-fpm/www.sock;
67
}

php-fpm-www.conf

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
; Unix user/group of processes
2121
; Note: The user is mandatory. If the group is not set, the default user's group
2222
; will be used.
23-
; RPM: apache user chosen to provide access to the same directories as httpd
24-
user = apache
25-
; RPM: Keep a group allowed to write in log dir.
26-
group = apache
23+
user = php-fpm
24+
group = php-fpm
2725

2826
; The address on which to accept FastCGI requests.
2927
; Valid syntaxes are:
@@ -35,7 +33,10 @@ group = apache
3533
; (IPv6 and IPv4-mapped) on a specific port;
3634
; '/path/to/unix/socket' - to listen on a unix socket.
3735
; Note: This value is mandatory.
38-
listen = /run/php-fpm/www.sock
36+
listen = 127.0.0.1:9000
37+
; WARNING: If you switch to a unix socket, you have to grant your webserver user
38+
; access to that socket by setting listen.acl_users to the webserver user.
39+
;listen = /run/php-fpm/www.sock
3940

4041
; Set listen(2) backlog.
4142
; Default Value: 511
@@ -52,7 +53,9 @@ listen = /run/php-fpm/www.sock
5253
; When POSIX Access Control Lists are supported you can set them using
5354
; these options, value is a comma separated list of user/group names.
5455
; When set, listen.owner and listen.group are ignored
55-
listen.acl_users = apache,nginx
56+
;listen.acl_users = apache,nginx
57+
;listen.acl_users = apache
58+
;listen.acl_users = nginx
5659
;listen.acl_groups =
5760

5861
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
@@ -433,6 +436,6 @@ php_admin_flag[log_errors] = on
433436
; See warning about choosing the location of these directories on your system
434437
; at http://php.net/session.save-path
435438
php_value[session.save_handler] = files
436-
php_value[session.save_path] = /var/lib/php/session
437-
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache
438-
;php_value[opcache.file_cache] = /var/lib/php/opcache
439+
php_value[session.save_path] = /var/lib/php/fpm/session
440+
php_value[soap.wsdl_cache_dir] = /var/lib/php/fpm/wsdlcache
441+
;php_value[opcache.file_cache] = /var/lib/php/fpm/opcache

php.conf

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,6 @@ AddType text/html .php
1616
#
1717
DirectoryIndex index.php
1818

19-
#
20-
# Redirect to local php-fpm (no mod_php in default configuration)
21-
#
22-
<IfModule !mod_php5.c>
23-
<IfModule !mod_php7.c>
24-
# Enable http authorization headers
25-
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
26-
27-
<FilesMatch \.(php|phar)$>
28-
SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
29-
</FilesMatch>
30-
</IfModule>
31-
</IfModule>
32-
33-
#
34-
# mod_php is deprecated as FPM is now used by default with httpd in event mode
35-
# mod_php is only used when explicitly enabled or httpd switch to prefork mode
3619
#
3720
# mod_php options
3821
#
@@ -57,8 +40,8 @@ DirectoryIndex index.php
5740
# those can be override in each configured vhost
5841
#
5942
php_value session.save_handler "files"
60-
php_value session.save_path "/var/lib/php/session"
61-
php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache"
43+
php_value session.save_path "/var/lib/php/mod_php/session"
44+
php_value soap.wsdl_cache_dir "/var/lib/php/mod_php/wsdlcache"
6245

63-
#php_value opcache.file_cache "/var/lib/php/opcache"
46+
#php_value opcache.file_cache "/var/lib/php/mod_php/opcache"
6447
</IfModule>

php73.spec

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Source9: php.modconf
8686
Source10: php.ztsmodconf
8787
Source13: nginx-fpm.conf
8888
Source14: nginx-php.conf
89+
Source15: httpd-fpm.conf
8990
# Configuration files for some extensions
9091
Source50: 10-opcache.ini
9192
Source51: opcache-default.blacklist
@@ -227,6 +228,30 @@ PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI
227228
implementation with some additional features useful for sites of
228229
any size, especially busier sites.
229230

231+
%package fpm-nginx
232+
Summary: Nginx configuration for PHP-FPM
233+
BuildArch: noarch
234+
Requires: %{name}-fpm = %{version}-%{release}
235+
Requires: nginx
236+
# safe replacement
237+
Provides: php-fpm-nginx = %{version}-%{release}
238+
Conflicts: php-fpm-nginx < %{version}-%{release}
239+
240+
%description fpm-nginx
241+
Nginx configuration files for the PHP FastCGI Process Manager.
242+
243+
%package fpm-httpd
244+
Summary: Apache HTTP Server configuration for PHP-FPM
245+
BuildArch: noarch
246+
Requires: %{name}-fpm = %{version}-%{release}
247+
Requires: httpd >= 2.4
248+
# safe replacement
249+
Provides: php-fpm-httpd = %{version}-%{release}
250+
Conflicts: php-fpm-httpd < %{version}-%{release}
251+
252+
%description fpm-httpd
253+
Apache HTTP Server configuration file for the PHP FastCGI Process Manager.
254+
230255
%package common
231256
Summary: Common files for PHP
232257
# All files licensed under PHP version 3.01, except
@@ -1354,11 +1379,16 @@ install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/php.d
13541379
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d
13551380
%endif
13561381
install -m 755 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php
1357-
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/session
1358-
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/wsdlcache
1359-
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/opcache
1382+
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/mod_php
1383+
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/mod_php/session
1384+
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/mod_php/wsdlcache
1385+
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/mod_php/opcache
13601386

13611387
# PHP-FPM stuff
1388+
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/fpm
1389+
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/fpm/session
1390+
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/fpm/wsdlcache
1391+
install -m 700 -d $RPM_BUILD_ROOT%{_sharedstatedir}/php/fpm/opcache
13621392
# Log
13631393
install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/log/php-fpm
13641394
install -m 755 -d $RPM_BUILD_ROOT/run/php-fpm
@@ -1377,6 +1407,8 @@ install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/php-fpm
13771407
# Nginx configuration
13781408
install -D -m 644 %{SOURCE13} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/php-fpm.conf
13791409
install -D -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/default.d/php.conf
1410+
# Apache httpd configuration
1411+
install -D -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_httpd_confdir}/php-fpm.conf
13801412

13811413
# Generate files lists and stub .ini files for each subpackage
13821414
for mod in pgsql odbc ldap snmp xmlrpc \
@@ -1514,6 +1546,13 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/php/modules/*.a \
15141546
# Remove irrelevant docs
15151547
rm -f README.{Zeus,QNX,CVS-RULES}
15161548

1549+
%pre fpm
1550+
getent group php-fpm >/dev/null || groupadd -r php-fpm
1551+
getent passwd php-fpm >/dev/null || \
1552+
useradd -r -g php-fpm -d %{_sharedstatedir}/php/fpm \
1553+
-s /sbin/nologin -c "php-fpm" php-fpm
1554+
exit 0
1555+
15171556
%post fpm
15181557
%systemd_post php-fpm.service
15191558

@@ -1531,9 +1570,10 @@ rm -f README.{Zeus,QNX,CVS-RULES}
15311570
%if %{with_zts}
15321571
%{_httpd_moddir}/libphp7-zts.so
15331572
%endif
1534-
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/session
1535-
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/wsdlcache
1536-
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/opcache
1573+
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/mod_php
1574+
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/mod_php/session
1575+
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/mod_php/wsdlcache
1576+
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/mod_php/opcache
15371577
%config(noreplace) %{_httpd_confdir}/php.conf
15381578
%config(noreplace) %{_httpd_modconfdir}/15-php.conf
15391579
%{_httpd_contentdir}/icons/php.gif
@@ -1586,26 +1626,30 @@ rm -f README.{Zeus,QNX,CVS-RULES}
15861626
%files fpm
15871627
%doc php-fpm.conf.default www.conf.default
15881628
%license fpm_LICENSE
1589-
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/session
1590-
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/wsdlcache
1591-
%attr(0770,root,apache) %dir %{_sharedstatedir}/php/opcache
1592-
%config(noreplace) %{_httpd_confdir}/php.conf
1629+
%attr(0770,root,php-fpm) %dir %{_sharedstatedir}/php/fpm
1630+
%attr(0770,root,php-fpm) %dir %{_sharedstatedir}/php/fpm/session
1631+
%attr(0770,root,php-fpm) %dir %{_sharedstatedir}/php/fpm/wsdlcache
1632+
%attr(0770,root,php-fpm) %dir %{_sharedstatedir}/php/fpm/opcache
15931633
%config(noreplace) %{_sysconfdir}/php-fpm.conf
15941634
%config(noreplace) %{_sysconfdir}/php-fpm.d/www.conf
15951635
%config(noreplace) %{_sysconfdir}/logrotate.d/php-fpm
1596-
%config(noreplace) %{_sysconfdir}/nginx/conf.d/php-fpm.conf
1597-
%config(noreplace) %{_sysconfdir}/nginx/default.d/php.conf
15981636
%{_unitdir}/php-fpm.service
15991637
%{_sbindir}/php-fpm
16001638
%dir %{_sysconfdir}/systemd/system/php-fpm.service.d
16011639
%dir %{_sysconfdir}/php-fpm.d
1602-
# log owned by apache for log
1603-
%attr(770,apache,root) %dir %{_localstatedir}/log/php-fpm
1640+
%attr(770,php-fpm,php-fpm) %dir %{_localstatedir}/log/php-fpm
16041641
%dir %ghost /run/php-fpm
16051642
%{_mandir}/man8/php-fpm.8*
16061643
%dir %{_datadir}/fpm
16071644
%{_datadir}/fpm/status.html
16081645

1646+
%files fpm-nginx
1647+
%config(noreplace) %{_sysconfdir}/nginx/conf.d/php-fpm.conf
1648+
%config(noreplace) %{_sysconfdir}/nginx/default.d/php.conf
1649+
1650+
%files fpm-httpd
1651+
%config(noreplace) %{_httpd_confdir}/php-fpm.conf
1652+
16091653
%files devel
16101654
%{_bindir}/php-config
16111655
%{_includedir}/php
@@ -1678,6 +1722,7 @@ rm -f README.{Zeus,QNX,CVS-RULES}
16781722
* Wed Apr 17 2019 Matt Linscott <[email protected]> - 7.3.4-2
16791723
- Initial port from Fedora to IUS
16801724
- Move httpd module to a mod_php subpackage
1725+
- Add fpm-nginx and fpm-httpd subpackages
16811726

16821727
* Tue Apr 2 2019 Remi Collet <[email protected]> - 7.3.4-1
16831728
- Update to 7.3.4 - http://www.php.net/releases/7_3_4.php

0 commit comments

Comments
 (0)