Skip to content

Instantly share code, notes, and snippets.

@jfreites
Last active April 5, 2017 21:09
Show Gist options
  • Save jfreites/829e73f5dc92f52cddf77d2e1f1df695 to your computer and use it in GitHub Desktop.
Save jfreites/829e73f5dc92f52cddf77d2e1f1df695 to your computer and use it in GitHub Desktop.
PHP installation script
PHP_TARGET_VERSION=5.4.32
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
wget http://ca.php.net/get/php-$PHP_TARGET_VERSION.tar.gz/from/this/mirror -O php-$PHP_TARGET_VERSION.tar.gz
tar -xzf php-$PHP_TARGET_VERSION.tar.gz
cd php-$PHP_TARGET_VERSION
sudo apt-get install build-essential autoconf libtool libxml2 libxml2-dev openssl libcurl4-openssl-dev \
libbz2-1.0 libbz2-dev libjpeg-dev libpng12-dev libfreetype6 libfreetype6-dev \
libldap-2.4-2 libldap2-dev libmcrypt4 libmcrypt-dev libmysqlclient-dev \
libxslt1.1 libxslt1-dev libxt-dev -y
./configure \
--enable-fpm \
--enable-pdo \
--with-pdo-mysql \
--enable-sockets \
--enable-exif \
--enable-soap \
--enable-ftp \
--enable-wddx \
--enable-pcntl \
--enable-soap \
--enable-bcmath \
--enable-mbstring \
--enable-dba \
--enable-gd-native-ttf \
--enable-zip \
--enable-calendar \
--with-mysql \
--with-mysqli \
--with-pdo-sqlite \
--with-iconv \
--with-zlib \
--with-bz2 \
--with-gettext \
--with-xmlrpc \
--with-openssl \
--with-mhash \
--with-mcrypt \
--with-xsl \
--with-curl \
--with-pcre-regex \
--with-gd \
--with-freetype-dir=/usr \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-ldap \
--with-pear \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--with-config-file-path=/etc/php/ \
--with-config-file-scan-dir=/etc/php/conf.d/ \
--with-libdir=lib/x86_64-linux-gnu
sudo make
sudo make install
/usr/local/bin/php -v
sudo mkdir -p /etc/php/conf.d
sudo cp php.ini-production /etc/php/php.ini
sudo cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
sudo chmod +x /etc/init.d/php-fpm
sudo update-rc.d php-fpm defaults
sudo cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
sudo /etc/init.d/php-fpm start
sudo netstat -tlnp |grep php-fpm
sudo pecl install memcache
sudo pecl install mongodb
sudo service php-fpm restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment