Skip to content

Commit 6d4ede5

Browse files
authored
Merge pull request #15 from devilbox/release-0.20
Upgrade vhost-gen and add PHP 5.2 compat mode
2 parents a31d1a8 + 354db1f commit 6d4ede5

4 files changed

Lines changed: 50 additions & 1 deletion

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LABEL \
1010
###
1111
### Build arguments
1212
###
13-
ARG VHOST_GEN_GIT_REF=0.10
13+
ARG VHOST_GEN_GIT_REF=0.11
1414
ARG CERT_GEN_GIT_REF=0.2
1515

1616
ENV BUILD_DEPS \

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ This Docker container adds a lot of injectables in order to customize it to your
127127
| PHP_FPM_ENABLE | bool | `0` | Enable PHP-FPM for the default vhost and the mass virtual hosts. |
128128
| PHP_FPM_SERVER_ADDR | string | `` | IP address or hostname of remote PHP-FPM server.<br/><strong>Required when enabling PHP.</strong> |
129129
| PHP_FPM_SERVER_PORT | int | `9000` | Port of remote PHP-FPM server |
130+
| COMPAT | str | - | Set this value to `5.2` to enable PHP-FPM 5.2 compatbility mode. (Only when using PHP-FPM 5.2) |
130131

131132
##### Optional environmental variables (default vhost)
132133

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
set -o pipefail
6+
7+
8+
############################################################
9+
# Functions
10+
############################################################
11+
12+
###
13+
### Ensure COMPAT is set
14+
###
15+
export_php_fpm_compat() {
16+
local varname="${1}"
17+
local debug="${2}"
18+
local value="0"
19+
20+
if ! env_set "${varname}"; then
21+
log "info" "\$${varname} not set. Not enabling PHP 5.2 compatibility mode." "${debug}"
22+
# Ensure variable is exported
23+
eval "export ${varname}=0"
24+
else
25+
value="$( env_get "${varname}" )"
26+
if [ "${value}" = "5.2" ]; then
27+
log "info" "PHP 5.2 compatibility mode: Enabled" "${debug}"
28+
# Ensure variable is exported
29+
eval "export ${varname}=1"
30+
else
31+
log "info" "PHP 5.2 compatibility mode: Disabled" "${debug}"
32+
# Ensure variable is exported
33+
eval "export ${varname}=0"
34+
fi
35+
fi
36+
}

data/docker-entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export_docker_logs "DOCKER_LOGS" "${DEBUG_LEVEL}"
7979
###
8080
### Ensure PHP-FPM variables are exported
8181
###
82+
export_php_fpm_compat "COMPAT" "${DEBUG_LEVEL}"
8283
export_php_fpm_enable "PHP_FPM_ENABLE" "${DEBUG_LEVEL}"
8384
export_php_fpm_server_addr "PHP_FPM_SERVER_ADDR" "${DEBUG_LEVEL}"
8485
export_php_fpm_server_port "PHP_FPM_SERVER_PORT" "${DEBUG_LEVEL}"
@@ -122,6 +123,17 @@ fi
122123
## vhost-gen Configuration
123124
#############################################################
124125

126+
###
127+
### Ensure PHP 5.2 conmpat mode is applied
128+
###
129+
if [ "${COMPAT}" = "1" ]; then
130+
# Replace current value 'FPM' with 'GENERIC'
131+
log "info" "Setting PHP 5.2 compat mode" "${DEBUG_LEVEL}"
132+
sed -i'' 's|\(ProxyFCGIBackendType\).*$|\1 GENERIC|g' /etc/vhost-gen/templates/apache24.yml
133+
else
134+
log "info" "Disabling PHP 5.2 compat mode" "${DEBUG_LEVEL}"
135+
fi
136+
125137
###
126138
### Enable and configure PHP-FPM
127139
###

0 commit comments

Comments
 (0)