How to Install PHPSuhosin on a Linux VPS

PHPSuhosin

Suhosin (pronounced ‘su-ho-shin’) is an advanced protection system for PHP scripts and the PHP core itself. Suhosin is an open source PHP patch developed for user security and to protect servers against several security flaws and vulnerabilities. Suhosin also protects the server against security flaws in the PHP based applications including WordPress, Joomla, Drupal, etc….

 

Install

You must have root access to the server to perform the following install instructions:

1) Login to your server as root user via SSH and make sure that all packages are up to date. You need to enter the below command to update all packages on your server.

yum -y update

 

2) Install php-devel and its dependencies

CentOS/Fedora

yum install php-devel

Ubuntu/Debian

apt-get install php-devel

 

3) Download the latest stable Suhosin release from the following URL using ‘wget’

wget https://download.suhosin.org/suhosin-0.9.38.tar.gz

 

4) Extract the downloaded tar file and change the current working directory to Suhosin

tar -xvf suhosin-0.9.38.tar.gz

cd cd suhosin-0.9.38

 

5) Perform the below commands one by one to compile Suhosin.

phpize

./configure

make

make install

 

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

This is a common error displayed during compilation. The error code itself explains that a C compiler is required to compile Suhosin. If you ever run into this error, please use the following command to install an acceptable C compiler on your server.

CentOS/Fedora

yum install gcc

Ubuntu/Debian

apt-get install gcc

 

6) Enter the following one-line code to add Suhosin extension to the PHP configuration file.

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

The default location for the PHP configuration file is ‘/etc/php.ini’.  If the path to PHP configuration file is unknown or a different location, 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

 

7) You may create a PHP info page to verify the Suhosin installation. To create a phpinfo file, open a plain text file, add the following lines, and save:

Filename: phpinfo.php

<?php

phpinfo ();

?>

Access the PHP info page using your favorite browser

http://yourdomain.com/phpinfo.php

 

If you need any further help, please do reach our support department.

 

 

Leave a Reply