Last active
October 20, 2021 07:25
-
-
Save swarad07/dfe674448fbb516201656c60c7f433de to your computer and use it in GitHub Desktop.
Script to compile php 5.2.17 from source, can be used with Vagrant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "### PROVISIONIN PHP 5.2.17..." | |
if [ "$(whoami)" != "root" ] | |
then | |
sudo su -s "$0" | |
exit | |
fi | |
# Add PostgreSQL Apt Repository (provides postgresql-server-dev-9.4) | |
echo "### Installing wget and other dependencies" | |
apt-get install -y wget | |
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
#Install dependencies | |
apt-get update | |
apt-get install -y gcc make build-essential libxml2-dev libcurl4-openssl-dev libpcre3-dev libbz2-dev libjpeg-dev libpng12-dev libfreetype6-dev libt1-dev libmcrypt-dev libmhash-dev freetds-dev libmysqlclient-dev unixodbc-dev postgresql-server-dev-9.4 libxslt1-dev | |
#Required to prevent an issue when compiling freetype support | |
mkdir -pv /usr/include/freetype2/freetype | |
ln -sf /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h | |
#Download PHP sources | |
echo "### Downloading php5.2.17 from http://museum.php.net/php5/php-5.2.17.tar.gz" | |
wget -c -t 3 -O ./php-5.2.17.tar.gz http://museum.php.net/php5/php-5.2.17.tar.gz | |
#Download Done, unpacking... | |
echo "### Unpacking in progress.." | |
tar xvfz php-5.2.17.tar.gz | |
#Unpacking done, inside php-5.2.17 dirctory. | |
echo "### Unpacking done, inside php directory now.." | |
cd php-5.2.17 | |
#Patching starts... | |
echo "### Patching Source of PHP Starts.." | |
#Downloading patch 1 .. | |
echo "### Downloading Patch 1.." | |
wget -c -t 3 -O ./libxml29_compat.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt | |
#Applying Patch 1 | |
echo "### Patching 1.." | |
patch -p0 -b < libxml29_compat.patch | |
#Downloading patch 2 .. | |
echo "### Download Patch 2.." | |
wget -c -t 3 -O ./debian_patches_disable_SSLv2_for_openssl_1_0_0.patch https://bugs.php.net/patch-display.php\?bug_id\=54736\&patch\=debian_patches_disable_SSLv2_for_openssl_1_0_0.patch\&revision=1305414559\&download\=1 | |
#Applying patch 2 .. | |
echo "### Patching 2.." | |
patch -p1 -b < debian_patches_disable_SSLv2_for_openssl_1_0_0.patch | |
#Downloading patch 3 .. | |
echo "### Download Patch 3.." | |
wget -c -t 3 -O - http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz | gunzip > ./php-5.2.17-fpm-0.5.14.patch | |
#Downloading patch 3 .. | |
echo "### Patching 3.." | |
patch -p1 < php-5.2.17-fpm-0.5.14.patch | |
echo "### Patching Done.." | |
#The big one, compile and install | |
echo "### Starting Compilation.." | |
./configure --prefix=/usr/share/php52 --datadir=/usr/share/php52 --mandir=/usr/share/man --bindir=/usr/bin/php52 --with-libdir=lib/x86_64-linux-gnu --includedir=/usr/include --with-config-file-path=$PHP_HOME/etc --with-config-file-scan-dir=$PHP_HOME/etc/conf.d --disable-debug --with-regex=php --disable-rpath --disable-static --disable-posix --with-pic --with-layout=GNU --with-pear=/usr/share/php --enable-calendar --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-bcmath --with-bz2 --enable-ctype --without-gdbm --with-iconv --enable-exif --enable-ftp --enable-cli --with-gettext --enable-mbstring --with-pcre-regex --enable-shmop --enable-sockets --enable-wddx --enable-fastcgi --enable-force-cgi-redirect --enable-fpm --with-mcrypt --with-zlib --enable-pdo --with-curl --enable-inline-optimization --enable-xml --enable-pcntl --enable-mbregex --with-mhash --with-xsl --enable-zip --with-gd --with-pdo-mysql --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-mysql --with-openssl --with-mysqli --with-kerberos --enable-dbase --with-mysqli=/usr/bin/mysql_config --enable-gd-native-ttf --with-t1lib=/usr --with-freetype-dir=/usr --with-ldap --with-kerberos=/usr --with-unixODBC=shared,/usr --with-imap-ssl --with-mssql --without-sqlite --with-sqlite --without-pdo-sqlite --with-pgsql --with-pdo-pgsql --enable-soap --with-pdo-sqlite | |
echo "### Make .." | |
make | |
echo "### Make install.." | |
make install | |
echo "### Install apache" | |
apt-get install -y apache2 apache2-dev | |
echo '### create apache2 directory, path shoudl be /etc/php52/apache2' | |
cd /etc | |
mkdir php52 | |
cd php52 | |
mkdir apache2 | |
cd apache2 | |
echo "### Copying recommeneded php.ini file" | |
cp /home/vagrant/php-5.2.17/php.ini-recommended . | |
/etc/init.d/apache2 restart | |
echo "### Install fast cgi" | |
apt-get install -y libapache2-mod-fastcgi | |
a2enmod cgi fastcgi actions | |
service apache2 restart | |
echo "#########################################" | |
echo "############ SCRIPT ENDS #############" | |
echo "#########################################" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
which version of os does this script run? Debian 10 or Ubuntu 18?