How to install Suhosin on a Linux VPS

suhosinSuhosin is an advanced protection system for scripts and the PHP core itself. It is an open source PHP patch used for protecting the users and servers against numerous vulnerabilities and security flaws in the PHP basaed applications including WordPress, Joomla, Drupal, etc…

In this article we will guide you through the simple and fast process of installing Suhosin from source on a Linux VPS.

Log in to your server as ‘root’ user and make sure that all packages are up to date

yum -y update

Install php-devel and its dependencies
CentOS / Fedora

yum install php-devel

Ubuntu / Debian

apt-get install php-devel

Download the latest stable Suhosin release from their official website

wget http://download.suhosin.org/suhosin-0.9.36.tgz

Unpack the downloaded Suhosin archive

tar -xvf suhosin-0.9.36.tgz

Change the current working directory to Suhosin’s directory

cd suhosin-0.9.36

Compile Suhosin

phpize
./configure
make
make install

If you get the following error message while trying to compile Suhosin

configure: error: no acceptable C compiler found in $PATH

Install ‘gcc’ on your server
CentOS / Fedora

yum install gcc

Ubuntu / Debian

apt-get install gcc

Add Suhosin extension to the PHP configuration file

echo extension=suhosin.so >> /etc/php.ini

If you do not know the location of the PHP confituration file, you can easily find it using the following command

php -i |grep php.ini
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

And finally, restart the web server for the changes to take effect.

That’s all. If you followed the steps above, Suhosin is installed on your Linux VPS.

You can verify that Suhosin is properly installed on your server by executing the following command

php -v
PHP 5.4.16 (cli) (built: Aug  6 2014 13:12:28)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Suhosin v0.9.36, Copyright (c) 2007-2014, by SektionEins GmbH

Or create an info.php file in the document root directory on your server containing the following lines

<?php
     phpinfo ();
?>

and access the page using your favorite web browser http://DOMAIN.TLD/info.php
suhosin
Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert linux admins to install Suhosin for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

1 thought on “How to install Suhosin on a Linux VPS”

Leave a Comment