Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install PHP 5.4.39 on Plesk 11.5 & 12 (CentOS 6)
#!/bin/bash
# Make sure you are up to date
yum -y update && yum -y install wget
# Install EPEL repository
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# Get us a clean working directory
mkdir /php
cd /php
# Install PHP dependencies
yum -y install gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel \
bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel \
aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel \
libmcrypt-devel unixODBC-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel \
mysql-devel readline-devel libedit-devel recode-devel libtidy-devel libtool-ltdl-devel
# Download PHP
wget http://nl1.php.net/get/php-5.4.39.tar.gz/from/this/mirror -O /php/php-5.4.39.tar.gz
# Extract PHP
tar xzvf /php/php-5.4.39.tar.gz
# Move to unpacked folder
cd /php/php-5.4.39
# Configure PHP build script
./configure \
--with-libdir=lib64 \
--cache-file=./config.cache \
--prefix=/php/php-5.4.39 \
--with-config-file-path=/php/php-5.4.39/etc \
--disable-debug \
--with-pic \
--disable-rpath \
--with-bz2 \
--with-curl \
--with-freetype-dir=/php/php-5.4.39 \
--with-png-dir=/php/php-5.4.39 \
--enable-gd-native-ttf \
--without-gdbm \
--with-gettext \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/php/php-5.4.39 \
--with-openssl \
--with-pspell \
--with-pcre-regex \
--with-zlib \
--enable-exif \
--enable-ftp \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--enable-wddx \
--with-kerberos \
--with-unixODBC=/usr \
--enable-shmop \
--enable-calendar \
--with-libxml-dir=/php/php-5.4.39 \
--enable-pcntl \
--with-imap \
--with-imap-ssl \
--enable-mbstring \
--enable-mbregex \
--with-gd \
--enable-bcmath \
--with-xmlrpc \
--with-ldap \
--with-ldap-sasl \
--with-mysql=/usr \
--with-mysqli \
--with-snmp \
--enable-soap \
--with-xsl \
--enable-xmlreader \
--enable-xmlwriter \
--enable-pdo \
--with-pdo-mysql \
--with-pear=/php/php-5.4.39/pear \
--with-mcrypt \
--without-pdo-sqlite \
--with-config-file-scan-dir=/php/php-5.4.39/php.d \
--without-sqlite3 \
--enable-intl
# Build & Install
make && make install
# Create a default php.ini
mkdir /php/php-5.4.39/etc
cp -a /etc/php.ini /php/php-5.4.39/etc/php.ini
# Set the timezone
timezone=$(grep -oP '(?<=")\w+/\w+' /etc/sysconfig/clock)
sed -i "s#;date.timezone =#date.timezone = $timezone#" /php/php-5.4.39/etc/php.ini
# Register with Plesk
/usr/local/psa/bin/php_handler \
--add \
-displayname "5.4.39" \
-path /php/php-5.4.39/bin/php-cgi \
-phpini /php/php-5.4.39/etc/php.ini \
-type fastcgi \
-id "fastcgi-5.4.39"
@aganz000

This comment has been minimized.

Copy link

@aganz000 aganz000 commented Oct 9, 2014

very useful! Thanks!

@computerworxdev

This comment has been minimized.

Copy link

@computerworxdev computerworxdev commented Nov 21, 2014

wget http://nl1.php.net/get/php-5.4.31.tar.gz/from/a/mirror -O /php/php-5.4.31.tar.gz
Not working ;(

@stayallive

This comment has been minimized.

Copy link
Owner Author

@stayallive stayallive commented Dec 18, 2014

@computerworxdev: Jep the /from/a/mirror should have been /from/this/mirror, has been fixed now.

Bit late to the party though, sorry :)

@raniellyferreira

This comment has been minimized.

Copy link

@raniellyferreira raniellyferreira commented Mar 7, 2015

See http://bugzilla.redhat.com/bugzilla for instructions.
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1
[2015-03-06 21:27:15] ERR [util_exec] proc_close() failed
Unable to register the PHP handler: Binary /php/php-5.4.36/bin/php-cgi doesn't exists

@dennisbuenviaje

This comment has been minimized.

Copy link

@dennisbuenviaje dennisbuenviaje commented Jun 30, 2015

I'm getting error when executing this line #90

Build & Install

make && make install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment