Skip to content

Commit be9f21a

Browse files
authored
Merge pull request #293 from ollyollyollyltd/fix/explicit-php-versioning
Fix/explicit php versioning
2 parents 8df2121 + e412868 commit be9f21a

File tree

9 files changed

+33
-18
lines changed

9 files changed

+33
-18
lines changed

extensions/core/disable_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ for ext in */; do \
88
if compgen -G "/etc/php/${PHP_VERSION}/cli/conf.d/*-$ext_no_slash.ini" > /dev/null; then
99
echo "***************** Disabling $ext_no_slash ******************"
1010
#rm -f /etc/php/${PHP_VERSION}/cli/conf.d/*-$ext_no_slash.ini
11-
phpdismod $ext_no_slash
11+
phpdismod -v $PHP_VERSION $ext_no_slash
1212
fi
1313
done

extensions/core/docker-install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,24 @@ fi
5454

5555
if [ -n "$EXTENSION" ]; then
5656
# Let's perform a test
57-
phpenmod $EXTENSION
57+
phpenmod -v $PHP_VERSION $EXTENSION
5858
/usr/bin/real_php -m | grep "${PHP_EXT_PHP_NAME:-${PHP_EXT_NAME:-$EXTENSION}}"
5959
# Check that there is no output on STDERR when starting php:
6060
OUTPUT=`/usr/bin/real_php -r "echo '';" 2>&1`
6161
[[ "$OUTPUT" == "" ]]
6262
# And now, let's disable it!
63-
phpdismod $EXTENSION
63+
phpdismod -v $PHP_VERSION $EXTENSION
6464
fi
6565

6666
if [ -n "$PECL_EXTENSION" ]; then
6767
# Let's perform a test
68-
PHP_EXTENSIONS="${PHP_EXT_NAME:-$PECL_EXTENSION}" /usr/bin/real_php /usr/local/bin/setup_extensions.php | bash
68+
PHP_EXTENSIONS="${PHP_EXT_NAME:-$PECL_EXTENSION}" PHP_VERSION="${PHP_VERSION}" /usr/bin/real_php /usr/local/bin/setup_extensions.php | bash
6969
PHP_EXTENSIONS="${PHP_EXT_NAME:-$PECL_EXTENSION}" /usr/bin/real_php /usr/local/bin/generate_conf.php > /etc/php/${PHP_VERSION}/cli/conf.d/testextension.ini
7070

7171
/usr/bin/real_php -m | grep "${PHP_EXT_PHP_NAME:-${PHP_EXT_NAME:-$PECL_EXTENSION}}"
7272
# Check that there is no output on STDERR when starting php:
7373
OUTPUT=`/usr/bin/real_php -r "echo '';" 2>&1`
7474
[[ "$OUTPUT" == "" ]]
75-
PHP_EXTENSIONS="" /usr/bin/real_php /usr/local/bin/setup_extensions.php | bash
75+
PHP_EXTENSIONS="" PHP_VERSION="${PHP_VERSION}" /usr/bin/real_php /usr/local/bin/setup_extensions.php | bash
7676
rm /etc/php/${PHP_VERSION}/cli/conf.d/testextension.ini
7777
fi

extensions/core/memcached/install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env bash
22

33
set -e
4-
export DEPENDENCIES="php-igbinary php-msgpack"
4+
export DEPENDENCIES="php${PHP_VERSION}-igbinary php${PHP_VERSION}-msgpack"
55
export EXTENSION=memcached
66

77
# we need to do some weird stuff to get memcached working
8-
phpdismod igbinary
9-
phpenmod igbinary
8+
phpdismod -v $PHP_VERSION igbinary
9+
phpenmod -v $PHP_VERSION igbinary
1010

1111
../docker-install.sh
1212

13-
phpdismod igbinary
13+
phpdismod -v $PHP_VERSION igbinary

extensions/core/mysqli/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export PACKAGE_NAME=mysql
77
../docker-install.sh
88

99
# Exception for this package that enables both mysqlnd and mysqli and pdo_mysql
10-
phpdismod mysqli
11-
phpdismod pdo_mysql
10+
phpdismod -v $PHP_VERSION mysqli
11+
phpdismod -v $PHP_VERSION pdo_mysql

extensions/core/redis/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ set -e
44
export EXTENSION=redis
55

66
# we need to do some weird stuff to get memcached working
7-
phpdismod igbinary
8-
phpenmod igbinary
7+
phpdismod -v $PHP_VERSION igbinary
8+
phpenmod -v $PHP_VERSION igbinary
99

1010
../docker-install.sh
1111

12-
phpdismod igbinary
12+
phpdismod -v $PHP_VERSION igbinary

utils/docker-entrypoint-as-root.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ sudo chown docker:docker /opt/php_env_var_cache.php
120120
/usr/bin/real_php /usr/local/bin/check_php_env_var_changes.php &> /dev/null
121121

122122
/usr/bin/real_php /usr/local/bin/generate_conf.php > /etc/php/${PHP_VERSION}/mods-available/generated_conf.ini
123-
/usr/bin/real_php /usr/local/bin/setup_extensions.php | sudo bash
123+
PHP_VERSION="${PHP_VERSION}" /usr/bin/real_php /usr/local/bin/setup_extensions.php | sudo bash
124124

125125
# output on the logs can be done by writing on the "tini" PID. Useful for CRONTAB
126126
TINI_PID=`ps -e | grep tini | awk '{print $1;}'`

utils/php_proxy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fi
1212

1313
if [[ "$REGENERATE" == "1" ]]; then
1414
/usr/bin/real_php /usr/local/bin/generate_conf.php | sudo tee "/etc/php/${PHP_VERSION}/mods-available/generated_conf.ini" > /dev/null
15-
/usr/bin/real_php /usr/local/bin/setup_extensions.php | sudo bash
15+
PHP_VERSION="${PHP_VERSION}" /usr/bin/real_php /usr/local/bin/setup_extensions.php | sudo bash
1616
fi
1717

1818
exec /usr/bin/real_php "$@"

utils/setup_extensions.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
$phpExtensions = getPhpExtensionsEnvVar();
1717

18+
$phpVersion = getPhpVersionEnvVar();
19+
1820
//foreach ($compiledExtensions as $phpExtension) {
1921
// $envName = 'PHP_EXTENSION_'.strtoupper($phpExtension);
2022
//
@@ -66,8 +68,8 @@
6668
}*/
6769

6870
if ($toDisable) {
69-
echo 'phpdismod '.implode(' ', $toDisable)."\n";
71+
echo 'phpdismod -v ' . $phpVersion . ' ' . implode(' ', $toDisable)."\n";
7072
}
7173
if ($toEnable) {
72-
echo 'phpenmod '.implode(' ', $toEnable)."\n";
74+
echo 'phpenmod -v ' . $phpVersion . ' ' . implode(' ', $toEnable)."\n";
7375
}

utils/utils.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ function getPhpExtensionsEnvVar(): array
7373
return $phpExtensions;
7474
}
7575

76+
function getPhpVersionEnvVar()
77+
{
78+
static $phpVersion = null;
79+
if ($phpVersion !== null) {
80+
return $phpVersion;
81+
}
82+
83+
$phpVersion = getenv('PHP_VERSION');
84+
85+
return $phpVersion;
86+
}
87+
88+
7689
function enableExtension(string $extensionName): bool {
7790
$phpExtensions = getPhpExtensionsEnvVar();
7891

0 commit comments

Comments
 (0)