-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Clément Désiles <[email protected]>
- Loading branch information
1 parent
92989fc
commit d174bec
Showing
3 changed files
with
77 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
# Install PHP extensions | ||
# @see https://olvlvl.com/2019-06-install-php-ext-source | ||
# @see https://stackoverflow.com/a/73834081 | ||
# @see https://packages.sury.org/php/dists/ | ||
|
||
error() { | ||
printf "\e[1;31m%s\e[0m" "${1:-Unknown error}" | ||
exit "${2:-1}" | ||
} | ||
|
||
[ -z "$PHP_ENV" ] && error "PHP_ENV is not set" 2 | ||
[ -z "$PHP_VERSION" ] && error "PHP_VERSION is not set" 3 | ||
|
||
PS_PHP_EXT="gd pdo_mysql zip intl fileinfo mbstring simplexml soap bcmath" | ||
PHP_GD_CONFIG="--with-jpeg"; | ||
|
||
if [ "7.1" = "$PHP_VERSION" ]; then | ||
PS_PHP_EXT="$PS_PHP_EXT mcrypt"; | ||
PHP_GD_CONFIG="--with-gd --with-jpeg --with-jpeg-dir --with-zlib-dir"; | ||
elif [ "7.2" = "$PHP_VERSION" ] || [ "7.3" = "$PHP_VERSION" ]; then | ||
PHP_GD_CONFIG="--with-jpeg-dir --with-zlib-dir"; | ||
fi | ||
|
||
# shellcheck disable=SC2086 | ||
docker-php-ext-configure gd $PHP_GD_CONFIG | ||
# shellcheck disable=SC2086 | ||
docker-php-ext-install $PS_PHP_EXT; | ||
|
||
if [ "production" = "$PHP_ENV" ]; then | ||
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | ||
rm -f "$PHP_INI_DIR/php.ini-development"; | ||
else | ||
mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | ||
rm -f "$PHP_INI_DIR/php.ini-production"; | ||
fi | ||
|
||
# Flashlight is a testinf platform, keep things simple | ||
sed -i 's/memory_limit = .*/memory_limit = -1/' "$PHP_INI_DIR/php.ini" | ||
sed -i 's/upload_max_filesize = .*/upload_max_filesize = 40M/' "$PHP_INI_DIR/php.ini" | ||
sed -i 's/post_max_size = .*/post_max_size = 40M/' "$PHP_INI_DIR/php.ini" | ||
|
||
# Remove php assets that might have been installed by package unaware of $PHP_INI_DIR | ||
rm -rf /etc/php* /usr/lib/php* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters