Skip to content

Instantly share code, notes, and snippets.

@notmii
Last active January 3, 2016 20:58
Show Gist options
  • Save notmii/8518055 to your computer and use it in GitHub Desktop.
Save notmii/8518055 to your computer and use it in GitHub Desktop.
Install PHP
#!/bin/bash
sudo apt-get remove --purge php
sudo apt-get install -y checkinstall auto-apt autoconf
sudo apt-get install -y libxml2-dev libcurl4-gnutls-dev curl libreadline6-dev libssl-dev
wget http://jp1.php.net/distributions/php-5.5.8.tar.gz \
&& tar xzf php-5.5.8.tar.gz
cd php-5.5.8
if [ ! -f ./configure ]; then
./buildconf --force
fi
PHP_FPM_CONF=" \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data"
PHP_OPTIONAL_CONF=" \
--enable-ftp"
PHP_MYSQL_CONF=" \
--with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd"
./buildconf --force \
&& auto-apt run ./configure \
--prefix=/usr/local \
--with-pear \
--with-zlib \
--with-curl \
--with-mysql \
--with-regex \
--with-openssl \
--enable-calendar \
--enable-zip \
--with-readline \
\
$PHP_FPM_CONF \
$PHP_OPTIONAL_CONF \
$PHP_MYSQL_CONF \
\
--enable-mbstring \
--enable-opcache \
--enable-sockets \
--enable-zip \
--enable-mysqlnd \
&& make \
&& sudo checkinstall \
&& php --version \
&& cd .. \
&& rm php-5.5.8 -rf \
&& rm php-5.5.8.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment