How to Install PHP Suhosin on a cPanel Server?

PHP Suhosin

The websites which are using CMS/platforms like WordPress, Joomla, Drupal and also other popular webapps are the most common target for internet hacks and attacks. The automatic updates for these websites should be scheduled whenever a version is released. The new release comes with bug fixes and security patches from the previous version. The website security will be affected for those websites which are not running periodic updates. You can use PHP extension Suhosin in case you come across this situation. Please note that Suhosin doesn’t update your websites but offers a protective layer against common, known PHP attacks on your server. Suhosin is installed server wide and not for a particular website, account or PHP version. Thus PHP Suhosin offers a better secure environment on your server for the websites to run with.

 

Installing PHP Suhosin

Installing PHP Suhosin on a cPanel server is not a difficult task. Anyone who has basic knowledge in command line can perform the simple installation steps easily. Before installing Suhosin, you need to check whether the extension is already installed on the server.

You may verify Suhosin installation on your server by running the following commands:

# php -v

# php -m | grep -i suhosin

If PHP Suhosin is installed on your server, it will be listed on the output when the above commands are run. Thus you can verify whether PHP Suhosin is already installed on your server.

The Suhosin is a PHP extension and therefore the installation doesn’t require Apache and PHP rebuild action. Cause cPanel provides “phpextensionmanager”, a script which is used to perform the Suhosin installation on your server. You can use this script to list all the available PHP extensions on your server. The phpextensionmanager can be used only to install available PHP extensions. To list all available PHP extensions on your server run the following command:

# /usr/local/cpanel/scripts/phpextensionmgr list

This is an example output that lists available PHP extensions:

# /usr/local/cpanel/scripts/phpextensionmgr list

Available Extensions:

EAccelerator

IonCubeLoader

Zendopt

Xcache

SourceGuardian

PHPSuHosin

If you need to know more regarding the phpextensionmanager usage information, please run the following command. I have also attached an example output for the following command.

# /usr/local/cpanel/scripts/phpextensionmgr help

Usage:

phpextensionmgr [options] [action] [extension]

 

Options:

–help       Help message

–prefix     Installation prefix for PHP (normally /usr/local)

 

Actions:

install      Install or update the extension

uninstall    Uninstall the extension

status       Display the installation status of the extension

list         Show available extensions

You can continue with the installation once you have verified that Suhosin is not installed on your server and is listed on the available extensions list. To continue with Suhosin installation, please run the following script:

# /usr/local/cpanel/scripts/phpextensionmgr install PHPSuHosin

Installing PHP extensions via phpextensionmanager is much faster compared to Apache and PHP rebuild feature, just to install/remove an extension. You may run the following commands to verify the PHP Suhosin installation. If PHPSuhosin or Suhosin is listed in the output, then you can confirm that Suhosin is installed on your server.

# php -v

# php -m | grep -i suhosin

 

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

 

 

Leave a Reply