Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 3f5ed60

Browse files
committed
ISSUE 69: Syntax and readability update.
1 parent 046c867 commit 3f5ed60

File tree

1 file changed

+39
-27
lines changed

1 file changed

+39
-27
lines changed

var/www/app-bin/php-wrapper

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,81 +3,89 @@
33
source /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
1317
export PHPRC=/etc
1418

1519
export 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
1823
export PHP_FCGI_CHILDREN=0
1924

2025
export 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
2631
PHP54_X_CGI=/opt/rh/php54/root/usr/bin/php-cgi
2732

2833
if [[ -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')"
3237
fi
3338

34-
PHP55_INSTALLED="false"
39+
PHP55_INSTALLED=false
3540
PHP55_X_CGI=/opt/rh/php55/root/usr/bin/php-cgi
3641

3742
if [[ -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')"
4146
fi
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}
4756
else
4857
# Default to the default distribution version
49-
X_PHP_CGI="/usr/bin/php-cgi"
58+
X_PHP_CGI=/usr/bin/php-cgi
5059
fi
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
5362
if [[ ${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
5564
fi
65+
5666
if [[ ${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
5868
fi
5969

6070
export TMP="${APACHE_CONTENT_ROOT}/var/tmp"
6171
export TEMP=${TMP}
6272
export 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
6774
PHP_OPTIONS_DISABLE_FUNCTIONS="system,exec,passthru,shell_exec,proc_open,show_source,popen,pcntl_fork,pcntl_exec,escapeshellarg,escapeshellcmd,openlog,closelog,uname,php_uname"
6875
PHP_OPTIONS_OPEN_BASE_DIR="${APACHE_CONTENT_ROOT}"
6976

7077
PHP_OPTIONS_MEMORY_LIMIT="32M"
7178
PHP_OPTIONS_POST_MAX_SIZE="32M"
7279
PHP_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
8086
PHP_OPTIONS_ERROR_REPORTING=22527
87+
PHP_OPTIONS_DISPLAY_ERRORS="Off"
88+
PHP_OPTIONS_HTML_ERRORS="Off"
8189

8290
PHP_OPTIONS_XDEBUG_SHOW_EXCEPTION_TRACE="Off"
8391
PHP_OPTIONS_XDEBUG_TRACE_ENABLE_TRIGGER="Off"
@@ -90,7 +98,7 @@ PHP_OPTIONS_XDEBUG_REMOTE_MODE="req"
9098
PHP_OPTIONS_XDEBUG_REMOTE_CONNECT_BACK="Off"
9199
PHP_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
94102
case ${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

Comments
 (0)