3 # Has to be run as admin
5 # To be kept in sync with setup_php_travis.sh
7 # @todo make it optional to disable xdebug ?
12 # note: these settings are not required for cli config
13 echo "cgi.fix_pathinfo = 1" >> "${1}"
14 echo "always_populate_raw_post_data = -1" >> "${1}"
16 # we disable xdebug for speed for both cli and web mode
22 DEBIAN_VERSION="$(lsb_release -s -c)"
24 if [ "${PHP_VERSION}" = default ]; then
25 if [ "${DEBIAN_VERSION}" = jessie -o "${DEBIAN_VERSION}" = precise -o "${DEBIAN_VERSION}" = trusty ]; then
30 # @todo check for mbstring presence in php5 (jessie) packages
31 DEBIAN_FRONTEND=noninteractive apt-get install -y \
35 php${PHPSUFFIX}-curl \
37 php${PHPSUFFIX}-mbstring \
38 php${PHPSUFFIX}-xdebug
40 DEBIAN_FRONTEND=noninteractive apt-get install -y language-pack-en-base software-properties-common
41 LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
44 DEBIAN_FRONTEND=noninteractive apt-get install -y \
46 php${PHP_VERSION}-cli \
47 php${PHP_VERSION}-dom \
48 php${PHP_VERSION}-curl \
49 php${PHP_VERSION}-fpm \
50 php${PHP_VERSION}-mbstring \
51 php${PHP_VERSION}-xdebug
53 update-alternatives --set php /usr/bin/php${PHP_VERSION}
56 PHPVER=$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2>/dev/null)
58 configure_php_ini /etc/php/${PHPVER}/fpm/php.ini
60 # use a nice name for the php-fpm service, so that it does not depend on php version running
61 service "php${PHPVER}-fpm" stop
62 ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm
64 # @todo shall we configure php-fpm?
69 a2enconf php${PHPVER}-fpm
70 service apache2 restart