6 # @todo make this idempotent so that it can be run multiple times in a row
7 echo "cgi.fix_pathinfo = 1" >> "${1}"
8 echo "always_populate_raw_post_data = -1" >> "${1}"
10 # @todo this only disables xdebug for CLI. To do the same for the FPM config as well, should we use instead `phpdismod` ?
11 XDEBUG_INI=$(php -i | grep xdebug.ini | grep -v '=>' | head -1)
12 if [ "$XDEBUG_INI" != "" ]; then
13 XDEBUG_INI="$(echo "$XDEBUG_INI" | tr -d ',')"
14 mv "$XDEBUG_INI" "$XDEBUG_INI.bak";
20 DEBIAN_VERSION="$(lsb_release -s -c)"
22 if [ "${PHP_VERSION}" = default ]; then
23 if [ "${DEBIAN_VERSION}" = jessie -o "${DEBIAN_VERSION}" = precise -o "${DEBIAN_VERSION}" = trusty ]; then
28 # @todo check for mbstring presence in php5 (jessie) packages
29 DEBIAN_FRONTEND=noninteractive apt-get install -y \
33 php${PHPSUFFIX}-curl \
35 php${PHPSUFFIX}-mbstring \
36 php${PHPSUFFIX}-xdebug
38 DEBIAN_FRONTEND=noninteractive apt-get install -y language-pack-en-base software-properties-common
39 LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
42 DEBIAN_FRONTEND=noninteractive apt-get install -y \
44 php${PHP_VERSION}-cli \
45 php${PHP_VERSION}-dom \
46 php${PHP_VERSION}-curl \
47 php${PHP_VERSION}-fpm \
48 php${PHP_VERSION}-mbstring \
49 php${PHP_VERSION}-xdebug
51 update-alternatives --set php /usr/bin/php${PHP_VERSION}
54 PHPVER=$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2>/dev/null)
56 configure_php_ini /etc/php/${PHPVER}/fpm/php.ini
58 # use a nice name for the php-fpm service, so that it does not depend on php version running
59 service "php${PHPVER}-fpm" stop
60 ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm
62 # @todo shall we configure php-fpm?
67 a2enconf php${PHPVER}-fpm
68 service apache2 restart