Wednesday, October 23, 2013

Install Suhosin For PHP 5.4 On cPanel Linux

EDIT: Since the release of this article, new versions of SuHosin have been release with official PHP 5.4+ support.

Please go to:
https://github.com/stefanesser/suhosin/releases

...for the most current version.


1) Grab the current source from github:
cd /usr/local/src

wget https://github.com/stefanesser/suhosin/tarball/master

tar zxvf master
2) Change to the directory just created and then prep Suhosin for PHP
cd /usr/local/src/stefanesser-suhosin-[this will change]

mv session.c session.c.old
wget https://raw.github.com/blino/suhosin/117b6aa6efec61afaa1431c698dad8eb553b55f5/session.c

phpize
Note: We pull the custom session.c above to fix an issue with NULL sessions in PHP 5.4, more info:
https://github.com/stefanesser/suhosin/pull/26

3) Configure, make and install
./configure && make && make install
4) Enable in PHP
echo extension=suhosin.so >> /usr/local/lib/php.ini
5) Restart Apache and check PHP
service httpd restart

php -v
...and you should see:

PHP 5.4.21 (cli) (built: Oct 23 2013 16:48:02)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies
with Suhosin v0.9.34-dev, Copyright (c) 2007-2012, by SektionEins GmbH

No comments:

Post a Comment