Red Hat / CentOS Linux Install Suhosin PHP 5 Protection Security Patch

by Vivek Gite · 5 comments

Q. Wordpress and many other open source application developers asks users to protect PHP apps using Suhosin patch to get protection from the full exploit. Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers from various attacks. How do I install Suhosin under RHEL / CentOS / Fedora Linux?

A. Suhosin was designed to protect your servers against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself including wordpress and many other open source php based apps.

Install Suhosin as extension

Download latest version of Suhosin, enter:
# cd /opt
# wget http://download.suhosin.org/suhosin-0.9.27.tgz

Make sure you have php-devel installed:
# yum install php-devel

Compile Suhosin under PHP 5 and RHEL / CentOS Linux

Type the following commands:
# cd suhosin-0.9.27
# phpize
#./configure
# make
# make install

Configure Suhosin

Type the following command to create Suhosin configuration file:
# echo 'extension=suhosin.so' > /etc/php.d/suhosin.ini

Restart web server

Type the following command to restart httpd:
# service httpd restart
If you are using lighttpd, enter:
# service lighttpd restart

Verify Suhosin installation

Type the following command:
$ php -v
Sample output:

PHP 5.1.6 (cli) (built: Jun 12 2008 05:02:36)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with XCache v1.2.2, Copyright (c) 2005-2007, by mOo
    with Suhosin v0.9.27, Copyright (c) 2007, by SektionEins GmbH

You can find more information by running phpinfo():

<?php
phpinfo();
?>

Sample output:

Fig.01: Suhosin information and settings displayed by phpinfo().

Fig.01: Suhosin information and settings displayed by phpinfo().

Further readings:

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 5 comments… read them below or add one }

1 diay 09.15.08 at 10:48 am

Excllent info.

2 Frolov Denis 09.15.08 at 2:30 pm

For build rpm package for Fedora/RHEL/CentOS


rpmbuild --rebuild http://repo.redhat-club.org/devel/redhat/5/SRPMS/suhosin-0.9.27-el5.rhc.1.src.rpm

After I test package it will be here http://repo.redhat-club.org/redhat/5/SRPMS/

3 Thx1138 09.15.08 at 4:30 pm

Suhosin hasn’t be updated in over a year… is it still a viable project and therefore safe to use?

4 vivek 09.15.08 at 5:15 pm

I’ve not seen any problem and it works like a charm.

5 bypasser 12.11.08 at 3:08 pm

straightforward tutorial. Thank you very much

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All