Skip to content

Instantly share code, notes, and snippets.

@stayallive
Last active May 4, 2018 19:59
Show Gist options
  • Save stayallive/dbb91ffa6f0fc6ca6ac3 to your computer and use it in GitHub Desktop.
Save stayallive/dbb91ffa6f0fc6ca6ac3 to your computer and use it in GitHub Desktop.
Install PHP 5.6.7 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.6.7.tar.gz/from/this/mirror -O /php/php-5.6.7.tar.gz
# Extract PHP
tar xzvf /php/php-5.6.7.tar.gz
# Move to unpacked folder
cd /php/php-5.6.7
# Configure PHP build script
./configure \
--with-libdir=lib64 \
--cache-file=./config.cache \
--prefix=/php/php-5.6.7 \
--with-config-file-path=/php/php-5.6.7/etc \
--disable-debug \
--with-pic \
--disable-rpath \
--with-bz2 \
--with-curl \
--with-freetype-dir=/php/php-5.6.7 \
--with-png-dir=/php/php-5.6.7 \
--enable-gd-native-ttf \
--without-gdbm \
--with-gettext \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/php/php-5.6.7 \
--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.6.7 \
--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.6.7/pear \
--with-mcrypt \
--without-pdo-sqlite \
--with-config-file-scan-dir=/php/php-5.6.7/php.d \
--without-sqlite3 \
--enable-intl \
--enable-opcache
# Build & Install
make && make install
# Create a default php.ini
mkdir /php/php-5.6.7/etc
cp -a /etc/php.ini /php/php-5.6.7/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.6.7/etc/php.ini
# Register with Plesk
/usr/local/psa/bin/php_handler \
--add \
-displayname "5.6.7" \
-path /php/php-5.6.7/bin/php-cgi \
-phpini /php/php-5.6.7/etc/php.ini \
-type fastcgi \
-id "fastcgi-5.6.7"
@FrangaL
Copy link

FrangaL commented Oct 16, 2014

epel=rpm --verify epel-release-6-8
if [ ! -f $epel ]
then
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
else
echo epel repo installed
fi

@extratempus
Copy link

After install I have this error:

(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server

PHP 5.6.4 on Parallels Plesk v12.0.18 - CentOS 6.6 (Final)

@nuxodin
Copy link

nuxodin commented Feb 7, 2015

me too :(

@kaspercools
Copy link

This really could be a number of things, but here's one solution that might possible do the trick:

check if the cgi_wrapper actually has the permissions to execute /php/php-5.6.4/bin/php-cgi. you can do this by tailing the /var/log/messages file. The problem might be found within the fact that httpd exec doesn't have sufficient rights on php-cgi bin. You can double-check this in /var/log/audit/audit.log

To grant httpd exec rights on php-cgi bin execute the following command:
sudo chcon -t httpd_sys_script_exec_t /php/php-5.6.4/bin/php-cgi

@joshstrom
Copy link

By the way, despite the other comments on this gist, I decided to give it a try on a server I was upgrading (CentOS 6, Plesk 11.5) and it worked absolutely flawlessly. The new version of PHP was available for selection in the Panel, and the hosted sites worked correctly.

Just wanted to post this in case there were any other folks on the fence about trying it because of the other comments.

Thanks!

@dfeg
Copy link

dfeg commented Jan 14, 2016

Seemed to work perfectly for me but php 5.6 is still not showing up in the Plesk Control pannel

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