Skip to content

Instantly share code, notes, and snippets.

@nurulimamnotes
Last active September 21, 2017 21:22
Show Gist options
  • Save nurulimamnotes/504a78a7a0d981ba6a87 to your computer and use it in GitHub Desktop.
Save nurulimamnotes/504a78a7a0d981ba6a87 to your computer and use it in GitHub Desktop.
Install HHVM with fallback PHP 7 PHP-FPM Nginx
echo "deb http://ftp.debian.org/debian/ wheezy main" >> /etc/apt/sources.list
apt-get update && apt-get upgrade -y
apt-get install -y libssl-dev libsslcommon2-dev libcurl4-openssl-dev pkg-config build-essential git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev
cd ~
sudo mkdir /usr/local/php7
git clone https://github.com/php/php-src.git
cd php-src
git checkout PHP-7.0.0
git pull
./buildconf --force
CONFIGURE_STRING="--prefix=/usr/local/php7 \
--with-config-file-scan-dir=/usr/local/php7/etc/conf.d \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--enable-exif \
--enable-dba \
--enable-ftp \
--with-gettext \
--with-gd \
--with-openssl \
--with-libdir=/lib/x86_64-linux-gnu \
--enable-mbstring \
--with-mcrypt \
--with-mhash \
--enable-mysqlnd \
--with-mysql=mysqlnd \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-openssl \
--enable-pcntl \
--with-pspell \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-zlib \
--enable-zip \
--with-readline \
--with-curl \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data"
./configure $CONFIGURE_STRING
make
sudo make install
mkdir /usr/local/php7/etc/conf.d
ln -s /usr/local/php7/sbin/php-fpm /usr/local/php7/sbin/php7-fpm
cp php.ini-production /usr/local/php7/lib/php.ini
echo "[www]
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
listen = /var/run/php7-fpm.sock
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3" >> /usr/local/php7/etc/php-fpm.d/www.conf
echo "[global]
pid = /var/run/php7-fpm.pid
error_log = /var/log/php7-fpm.log
include=/usr/local/php7/etc/php-fpm.d/*.conf" >> /usr/local/php7/etc/php-fpm.conf
echo "zend_extension=opcache.so" >> /usr/local/php7/etc/conf.d/modules.ini
wget https://gist.githubusercontent.com/nurulimamnotes/ab174223006b3dabefed/raw/7ade56d5261d010e72d5cd49ccf5042c9c856d18/php7-fpm -O /etc/init.d/php7-fpm
chmod +x /etc/init.d/php7-fpm
update-rc.d php7-fpm defaults
service php7-fpm start
apt-get install nginx -y
rm /etc/nginx/sites-available/default
wget https://gist.githubusercontent.com/nurulimamnotes/1fd3706aeb6383a7e600/raw/f7a85c4ac927388b6a2fe7692dd5aebf83e09ffb/nginx-fallback -O /etc/nginx/sites-available/default
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
echo deb http://dl.hhvm.com/debian jessie main | sudo tee /etc/apt/sources.list.d/hhvm.list
sudo apt-get update
sudo apt-get install hhvm -y
rm /etc/hhvm/server.ini
echo "; php options
pid = /var/run/hhvm/pid
; hhvm specific
hhvm.server.file_socket=/var/run/hhvm/hhvm.sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
hhvm.mysql.typed_results = false
; Generate JIT codes sooner!
hhvm.eval.jit_warmup_requests = 1
; Disable Perf debugging
hhvm.keep_perf_pid_map = 0
hhvm.perf_pid_map = 0
hhvm.perf_data_map = 0" >> /etc/hhvm/server.ini
update-rc.d hhvm defaults
service php7-fpm restart && service hhvm restart && service nginx restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment