33source /etc/apache-bootstrap.conf
44
55# Allow PHP settings to be varied by passing a parameter to php-wrapper
6- PHP_VERSION=$1
7- PHP_WRAPPER_MODE=$2
6+ PHP_VERSION=${1}
87
9- # VirtualHost specific options can be used to override the PHP options set in the wrapper
10- PHP_VHOST_OPTIONS=$3
8+ # Mode of opperation: production,development,debug.
9+ # Used to enable appropriate php options for requirements
10+ PHP_WRAPPER_MODE=${2}
11+
12+ # VirtualHost specific options can be used to override the PHP options set in
13+ # this wrapper
14+ PHP_VHOST_OPTIONS=${3}
1115
1216# Set path to php.ini
1317export PHPRC=/etc
1418
1519export PHP_FCGI_MAX_REQUESTS=15000
1620
17- # PHP child process management (PHP_FCGI_CHILDREN) should always be disabled with mod_fcgid
21+ # PHP child process management (PHP_FCGI_CHILDREN) should always be disabled
22+ # with mod_fcgid
1823export PHP_FCGI_CHILDREN=0
1924
2025export REDIRECT_STATUS=200
2126
22- X_NICE=" /bin/nice"
23- NICENESS_PHP_CGI=" 15 "
27+ X_NICE=/bin/nice
28+ NICENESS_PHP_CGI=15
2429
25- PHP54_INSTALLED=" false"
30+ PHP54_INSTALLED=false
2631PHP54_X_CGI=/opt/rh/php54/root/usr/bin/php-cgi
2732
2833if [[ -f /opt/rh/php54/enable ]]; then
29- PHP54_INSTALLED=" true"
34+ PHP54_INSTALLED=true
3035 source /opt/rh/php54/enable
3136 export X_SCLS=" $( scl enable php54 ' echo $X_SCLS' ) "
3237fi
3338
34- PHP55_INSTALLED=" false"
39+ PHP55_INSTALLED=false
3540PHP55_X_CGI=/opt/rh/php55/root/usr/bin/php-cgi
3641
3742if [[ -f /opt/rh/php55/enable ]]; then
38- PHP55_INSTALLED=" true"
43+ PHP55_INSTALLED=true
3944 source /opt/rh/php55/enable
4045 export X_SCLS=" $( scl enable php55 ' echo $X_SCLS' ) "
4146fi
4247
43- if [[ ${PHP_VERSION} == " php55" ]] && [[ " PHP55_INSTALLED" == " true" ]] && [[ -f ${PHP55_X_CGI} ]]; then
44- X_PHP_CGI=" ${PHP55_X_CGI} "
45- elif [[ ${PHP_VERSION} == " php54" ]] && [[ " PHP54_INSTALLED" == " true" ]] && [[ -f ${PHP54_X_CGI} ]]; then
46- X_PHP_CGI=" ${PHP54_X_CGI} "
48+ if [[ ${PHP_VERSION} == php55 ]] \
49+ && [[ ${PHP55_INSTALLED} == true ]] \
50+ && [[ -f ${PHP55_X_CGI} ]]; then
51+ X_PHP_CGI=${PHP55_X_CGI}
52+ elif [[ ${PHP_VERSION} == php54 ]] \
53+ && [[ ${PHP54_INSTALLED} == true ]] \
54+ && [[ -f ${PHP54_X_CGI} ]]; then
55+ X_PHP_CGI=${PHP54_X_CGI}
4756else
4857 # Default to the default distribution version
49- X_PHP_CGI=" /usr/bin/php-cgi"
58+ X_PHP_CGI=/usr/bin/php-cgi
5059fi
5160
52- # Unset MySQL host address and port environment variables if they are not set in the vhost
61+ # Unset MySQL environment variables if they are not set in the vhost
5362if [[ ${DB_MYSQL_PORT_3306_TCP_ADDR} == ' ${DB_MYSQL_PORT_3306_TCP_ADDR}' ]]; then
54- export DB_MYSQL_PORT_3306_TCP_ADDR=
63+ unset DB_MYSQL_PORT_3306_TCP_ADDR
5564fi
65+
5666if [[ ${DB_MYSQL_PORT_3306_TCP_PORT} == ' ${DB_MYSQL_PORT_3306_TCP_PORT}' ]]; then
57- export DB_MYSQL_PORT_3306_TCP_PORT=
67+ unset DB_MYSQL_PORT_3306_TCP_PORT
5868fi
5969
6070export TMP=" ${APACHE_CONTENT_ROOT} /var/tmp"
6171export TEMP=${TMP}
6272export TMPDIR=${TMP}
6373
64- # PHP Configuration Options that may need to be customised for different app features
65-
66- # # Important: Make sure you do not add spaces in this setting
6774PHP_OPTIONS_DISABLE_FUNCTIONS=" system,exec,passthru,shell_exec,proc_open,show_source,popen,pcntl_fork,pcntl_exec,escapeshellarg,escapeshellcmd,openlog,closelog,uname,php_uname"
6875PHP_OPTIONS_OPEN_BASE_DIR=" ${APACHE_CONTENT_ROOT} "
6976
7077PHP_OPTIONS_MEMORY_LIMIT=" 32M"
7178PHP_OPTIONS_POST_MAX_SIZE=" 32M"
7279PHP_OPTIONS_UPLOAD_MAX_FILESIZE=" 24M"
7380
74- PHP_OPTIONS_DISPLAY_ERRORS=" Off"
75- PHP_OPTIONS_HTML_ERRORS=" Off"
76- # We use the numeric values here - found for environment with php -r "echo E_ALL & ~E_DEPRECATED;"
81+ # Use numeric values here.
82+ # To identify the correct value use: php -r "echo E_ALL & ~E_DEPRECATED;"
7783# Default Value: E_ALL & ~E_NOTICE = 30711
7884# Development Value: E_ALL | E_STRICT = 32767
7985# Production Value: E_ALL & ~E_DEPRECATED = 22527
8086PHP_OPTIONS_ERROR_REPORTING=22527
87+ PHP_OPTIONS_DISPLAY_ERRORS=" Off"
88+ PHP_OPTIONS_HTML_ERRORS=" Off"
8189
8290PHP_OPTIONS_XDEBUG_SHOW_EXCEPTION_TRACE=" Off"
8391PHP_OPTIONS_XDEBUG_TRACE_ENABLE_TRIGGER=" Off"
@@ -90,7 +98,7 @@ PHP_OPTIONS_XDEBUG_REMOTE_MODE="req"
9098PHP_OPTIONS_XDEBUG_REMOTE_CONNECT_BACK=" Off"
9199PHP_OPTIONS_XDEBUG_PROFILER_ENABLE_TRIGGER=" Off"
92100
93- # The PHP options can be set appropriately for development / debug / production use
101+ # Set the PHP options appropriately for requirements
94102case ${PHP_WRAPPER_MODE} in
95103 development|debug)
96104 PHP_OPTIONS_DISPLAY_ERRORS=" On"
@@ -174,4 +182,8 @@ PHP_OPTIONS="
174182"
175183
176184# FastCGI-enabled PHP executable
177- exec ${X_NICE} -n ${NICENESS_PHP_CGI} ${X_PHP_CGI} ${PHP_OPTIONS} ${PHP_VHOST_OPTIONS}
185+ exec ${X_NICE} \
186+ -n ${NICENESS_PHP_CGI} \
187+ ${X_PHP_CGI} \
188+ ${PHP_OPTIONS} \
189+ ${PHP_VHOST_OPTIONS}
0 commit comments