@@ -6,6 +6,66 @@ source "/catapult/provisioners/redhat/modules/catapult.sh"
6
6
sudo yum remove -y * php56*
7
7
sudo yum remove -y * php70*
8
8
9
+ # ################
10
+ # PHP 7.3 PHP_FPM
11
+ # /etc/opt/rh/rh-php73/php.ini
12
+ # /opt/rh/rh-php73/root/usr/bin/php
13
+ # /var/opt/rh/rh-php73/log/php-fpm
14
+ # sudo yum list \*-php73-\*
15
+ # ################
16
+
17
+ # core extensions
18
+ sudo yum install -y rh-php73
19
+ # These are not actual extensions. They are part of the PHP core and cannot be left out of a PHP binary with compilation options.
20
+
21
+ # configure php-fpm
22
+ if ([ " ${4} " == " apache" ] || [ " ${4} " == " apache-node" ]); then
23
+ sudo yum install -y rh-php73-php-fpm
24
+ sed -i -e " s#^listen = 127.0.0.1:9000#listen = 127.0.0.1:9730#g" /etc/opt/rh/rh-php73/php-fpm.d/www.conf
25
+ sudo systemctl enable rh-php73-php-fpm
26
+ sudo systemctl start rh-php73-php-fpm
27
+ fi
28
+
29
+ # php.ini configuration options
30
+ # set the timezone
31
+ sed -i -e " s#\;date\.timezone.*#date.timezone = \" $( catapult company.timezone_redhat) \" #g" /etc/opt/rh/rh-php73/php.ini
32
+ # increase the post_max_size
33
+ sed -i -e " s#^post_max_size.*#post_max_size = 64M#g" /etc/opt/rh/rh-php73/php.ini
34
+ # increase the upload_max_filesize
35
+ sed -i -e " s#^upload_max_filesize.*#upload_max_filesize = 16M#g" /etc/opt/rh/rh-php73/php.ini
36
+ # hide x-powered-by
37
+ sed -i -e " s#^expose_php.*#expose_php = Off#g" /etc/opt/rh/rh-php73/php.ini
38
+ # increase php memory limit for tools like composer
39
+ sed -i -e " s#^memory_limit.*#memory_limit = 256M#g" /etc/opt/rh/rh-php73/php.ini
40
+ # display errors on screen using the default recommendations for development and production
41
+ if ([ " $1 " = " dev" ] || [ " $1 " = " test" ]); then
42
+ sed -i -e " s#^display_errors.*#display_errors = On#g" /etc/opt/rh/rh-php73/php.ini
43
+ sed -i -e " s#^error_reporting.*#error_reporting = E_ALL#g" /etc/opt/rh/rh-php73/php.ini
44
+ else
45
+ sed -i -e " s#^display_errors.*#display_errors = Off#g" /etc/opt/rh/rh-php73/php.ini
46
+ sed -i -e " s#^error_reporting.*#error_reporting = E_ALL \& \~E_DEPRECATED \& \~E_STRICT#g" /etc/opt/rh/rh-php73/php.ini
47
+ fi
48
+
49
+ # bundled extensions
50
+ # These extensions are bundled with PHP.
51
+ sudo yum install -y rh-php73-php-bcmath rh-php73-php-gd rh-php73-php-intl rh-php73-php-mbstring rh-php73-php-opcache rh-php73-php-soap rh-php73-php-xmlrpc
52
+ # disable opcache for dev
53
+ if [ " $1 " = " dev" ]; then
54
+ sudo bash -c ' echo "/var/www" > /etc/opt/rh/rh-php73/php.d/opcache-default.blacklist'
55
+ else
56
+ sudo bash -c ' echo "" > /etc/opt/rh/rh-php73/php.d/opcache-default.blacklist'
57
+ fi
58
+
59
+ # external extensions
60
+ # These extensions are bundled with PHP but in order to compile them, external libraries will be needed.
61
+ sudo yum install -y rh-php73-php-gmp rh-php73-php-mysqlnd
62
+
63
+ # pecl extensions
64
+ # https://blog.remirepo.net/post/2017/02/23/Additional-PHP-packages-for-RHSCL
65
+ curl --output /etc/yum.repos.d/rhscl-centos-release-scl-epel-7.repo wget https://copr.fedorainfracloud.org/coprs/rhscl/centos-release-scl/repo/epel-7/rhscl-centos-release-scl-epel-7.repo
66
+ # These extensions are available from » PECL. They may require external libraries. More PECL extensions exist but they are not documented in the PHP manual yet.
67
+ sudo yum install -y sclo-php73-php-pecl-imagick sclo-php73-php-pecl-uploadprogress
68
+
9
69
# ################
10
70
# PHP 7.2 PHP_FPM
11
71
# /etc/opt/rh/rh-php72/php.ini
@@ -243,6 +303,10 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
243
303
sed --in-place --expression " s#newrelic\.appname.*#newrelic.appname = \" $( catapult company.name | tr ' [:upper:]' ' [:lower:]' ) -${1} -redhat\" #g" " /usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template"
244
304
sed --in-place --expression " s#;newrelic\.daemon.\port.*#newrelic.daemon.port = \" @newrelic-daemon\" #g" " /usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template"
245
305
sed --in-place --expression " s/\" REPLACE_WITH_REAL_KEY\" /\" $( catapult company.newrelic_license_key) \" /g" " /usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template"
306
+ # rh-php73
307
+ rm --force " /opt/rh/rh-php73/root/usr/lib64/php/modules/newrelic.so"
308
+ cp " /usr/share/newrelic/newrelic-php5-8.4.0.231-linux/agent/x64/newrelic-20170718.so" " /opt/rh/rh-php73/root/usr/lib64/php/modules/newrelic.so"
309
+ cp " /usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template" " /etc/opt/rh/rh-php73/php.d/newrelic.ini"
246
310
# rh-php72
247
311
rm --force " /opt/rh/rh-php72/root/usr/lib64/php/modules/newrelic.so"
248
312
cp " /usr/share/newrelic/newrelic-php5-8.4.0.231-linux/agent/x64/newrelic-20170718.so" " /opt/rh/rh-php72/root/usr/lib64/php/modules/newrelic.so"
@@ -253,7 +317,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
253
317
cp " /usr/share/newrelic/newrelic-php5-8.4.0.231-linux/scripts/newrelic.ini.template" " /etc/opt/rh/rh-php71/php.d/newrelic.ini"
254
318
255
319
# new relic apm php installed but we need to set configuration
256
- NR_INSTALL_PHPLIST=" /usr/bin:/opt/rh/rh-php71/root/usr/bin:/opt/rh/rh-php72/root/usr/bin" ; export NR_INSTALL_PHPLIST
320
+ NR_INSTALL_PHPLIST=" /usr/bin:/opt/rh/rh-php71/root/usr/bin:/opt/rh/rh-php72/root/usr/bin:/opt/rh/rh-php73/root/usr/bin " ; export NR_INSTALL_PHPLIST
257
321
NR_INSTALL_SILENT=" true" ; export NR_INSTALL_SILENT
258
322
NR_INSTALL_KEY=" $( catapult company.newrelic_license_key) " ; export NR_INSTALL_KEY
259
323
/usr/bin/newrelic-install install
@@ -262,6 +326,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
262
326
if [ -S /tmp/.newrelic.sock ]; then
263
327
sudo rm -f /tmp/.newrelic.sock
264
328
/etc/init.d/newrelic-daemon restart
329
+ sudo systemctl restart rh-php73-php-fpm
265
330
sudo systemctl restart rh-php72-php-fpm
266
331
sudo systemctl restart rh-php71-php-fpm
267
332
sudo systemctl restart php-fpm
@@ -279,6 +344,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
279
344
# cat /var/log/httpd/error_log* | grep Max
280
345
281
346
# look for php-fpm max errors
347
+ # cat /var/opt/rh/rh-php73/log/php-fpm/error.log* | grep max
282
348
# cat /var/opt/rh/rh-php72/log/php-fpm/error.log* | grep max
283
349
# cat /var/opt/rh/rh-php71/log/php-fpm/error.log* | grep max
284
350
# cat /var/log/php-fpm/error.log* | grep max
@@ -324,14 +390,20 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
324
390
# calculate configuration based on above values
325
391
# /catapult/provisioners/redhat/installers/php/configuration-calculator.xlsx
326
392
393
+ sed -i -e " s#^pm.max_children.*#pm.max_children = 300#g" /etc/opt/rh/rh-php73/php-fpm.d/www.conf
327
394
sed -i -e " s#^pm.max_children.*#pm.max_children = 300#g" /etc/opt/rh/rh-php72/php-fpm.d/www.conf
328
395
sed -i -e " s#^pm.max_children.*#pm.max_children = 300#g" /etc/opt/rh/rh-php71/php-fpm.d/www.conf
329
396
sed -i -e " s#^pm.max_children.*#pm.max_children = 300#g" /etc/php-fpm.d/www.conf
330
397
398
+ sed -i -e " s#.*pm.max_requests.*#pm.max_requests = 500#g" /etc/opt/rh/rh-php73/php-fpm.d/www.conf
331
399
sed -i -e " s#.*pm.max_requests.*#pm.max_requests = 500#g" /etc/opt/rh/rh-php72/php-fpm.d/www.conf
332
400
sed -i -e " s#.*pm.max_requests.*#pm.max_requests = 500#g" /etc/opt/rh/rh-php71/php-fpm.d/www.conf
333
401
sed -i -e " s#.*pm.max_requests.*#pm.max_requests = 500#g" /etc/php-fpm.d/www.conf
334
402
403
+ echo -e " \n> php 7.3 configuration"
404
+ /opt/rh/rh-php73/root/usr/bin/php --version
405
+ /opt/rh/rh-php73/root/usr/bin/php --modules
406
+
335
407
echo -e " \n> php 7.2 configuration"
336
408
/opt/rh/rh-php72/root/usr/bin/php --version
337
409
/opt/rh/rh-php72/root/usr/bin/php --modules
@@ -345,6 +417,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
345
417
/usr/bin/php --modules
346
418
347
419
# reload php-fpm for configuration changes to take effect
420
+ sudo systemctl reload rh-php73-php-fpm
348
421
sudo systemctl reload rh-php72-php-fpm
349
422
sudo systemctl reload rh-php71-php-fpm
350
423
sudo systemctl reload php-fpm
@@ -355,6 +428,7 @@ if ([ "${4}" == "apache" ] || [ "${4}" == "apache-node" ]); then
355
428
# cat /var/log/httpd/error_log
356
429
# [Tue Dec 26 21:06:23.816950 2017] [mpm_prefork:notice] [pid 792] AH00171: Graceful restart requested, doing restart
357
430
# [Tue Dec 26 21:06:24.648573 2017] [core:notice] [pid 792] AH00060: seg fault or similar nasty error detected in the parent process
431
+ sudo systemctl start rh-php73-php-fpm
358
432
sudo systemctl start rh-php72-php-fpm
359
433
sudo systemctl start rh-php71-php-fpm
360
434
sudo systemctl start php-fpm
0 commit comments