3 # Has to be run as admin
5 # To be kept in sync with setup_php_travis.sh
10 echo "cgi.fix_pathinfo = 1" >> "${1}"
11 echo "always_populate_raw_post_data = -1" >> "${1}"
13 # @todo this only disables xdebug for CLI. To do the same for the FPM config as well, should we use instead `phpdismod` ?
14 XDEBUG_INI=$(php -i | grep xdebug.ini | grep -v '=>' | head -1)
15 if [ "$XDEBUG_INI" != "" ]; then
16 XDEBUG_INI="$(echo "$XDEBUG_INI" | tr -d ',')"
17 mv "$XDEBUG_INI" "$XDEBUG_INI.bak";
23 DEBIAN_VERSION="$(lsb_release -s -c)"
25 if [ "${PHP_VERSION}" = default ]; then
26 if [ "${DEBIAN_VERSION}" = jessie -o "${DEBIAN_VERSION}" = precise -o "${DEBIAN_VERSION}" = trusty ]; then
31 # @todo check for mbstring presence in php5 (jessie) packages
32 DEBIAN_FRONTEND=noninteractive apt-get install -y \
36 php${PHPSUFFIX}-curl \
38 php${PHPSUFFIX}-mbstring \
39 php${PHPSUFFIX}-xdebug
41 DEBIAN_FRONTEND=noninteractive apt-get install -y language-pack-en-base software-properties-common
42 LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
45 DEBIAN_FRONTEND=noninteractive apt-get install -y \
47 php${PHP_VERSION}-cli \
48 php${PHP_VERSION}-dom \
49 php${PHP_VERSION}-curl \
50 php${PHP_VERSION}-fpm \
51 php${PHP_VERSION}-mbstring \
52 php${PHP_VERSION}-xdebug
54 update-alternatives --set php /usr/bin/php${PHP_VERSION}
57 PHPVER=$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2>/dev/null)
59 configure_php_ini /etc/php/${PHPVER}/fpm/php.ini
61 # use a nice name for the php-fpm service, so that it does not depend on php version running
62 service "php${PHPVER}-fpm" stop
63 ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm
65 # @todo shall we configure php-fpm?
70 a2enconf php${PHPVER}-fpm
71 service apache2 restart