PHP-FPM Automated Build Script

This article features a script to automate the installation of PHP-FPM.

This script can be used to automate the PHP build process on a Nginx / FPM server:

#!/bin/bash

 mkdir -p /var/log/build/php/

 date=$(date +%s)

 log=/var/log/build/php/php.build.$date.log

 src=/usr/local/src/php-5.4.6 # This can be changed to any uncompressed PHP source folder

 cd $src

 echo "--- BUILD STARTED ---" | tee $log

 echo "BUILD LOG - $(date +%m.%d.%y) - $date" | tee -a $log

 # Build and Install

 make clean

 ./configure \

 --enable-fpm \

 --with-mysql --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config \

 --with-curl=/usr/lib \

 --enable-zip \

 --enable-mbstring \

 --with-mcrypt=/usr/lib64 \

 --with-openssl=/usr \

 --enable-sockets | tee -a $log \

 && make | tee -a $log \

 && make install | tee -a $log

 echo "--- BUILD COMPLETE ---" | tee -a $log

 echo "Full build log available at $log"

 

Was this answer helpful? 10 Users Found This Useful (30 Votes)