PHP 5.3.11 cgi with Suhosin extension solved

ssgill

Verified User
Joined
May 9, 2012
Messages
173
Hello all, just adding my procedure for adding suhosin extension to PHP 5.3.11 cgi. There are extensive how to's but nothing worked for me. Tried quite a few of them and always got this error

PHP Warning: PHP Startup: suhosin: Unable to initialize module
Module compiled with module API=20060613
PHP compiled with module API=20090626

Prerequisite: you can have any version of php cgi installed only difference is the Suhosin version that you need.

My current setup is PHP 5.3.11 suphp with zend

PHP5 installation directory : /usr/local/php5/
PHP5 ini : /usr/local/etc/php5/cgi/php.ini

if yours is different please change the paths in commands.

1) change directory to php bin

cd /usr/local/php5/bin

2) Download suhosion/untar and go to directory

wget http://download.suhosin.org/suhosin-0.9.33.tgz
tar xvf suhosin-0.9.33.tgz
cd suhosin-0.9.33

3) PHPIZE with correct phpize : check your path after sudo
sudo /usr/local/php5/bin/phpize

4) Enable and configure suhosin : check path for correct php-config

sudo ./configure --enable-suhosin --with-php-config=/usr/local/php5/bin/php-config
sudo make
sudo make install

5) You will get message that extension has created in file:

/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626

we need to add this to php.ini file to load suhosin.so

1) if you already have path configured in php.ini or want to move it different extension directory then just add/edit path in php.in file move suhosin.so to that directory from :

/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/suhosin.so

to that directory and add line in extension block

extension=suhosin.so

2) Or you can simply add full path in php.ini.

vi /usr/local/etc/php5/cgi/php.ini

find the extension block and add this in the start
extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/suhosin.so

That's it, check your php version
php -v

PHP 5.3.13 (cli) (built: May 15 2012 10:42:54)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

or from browser

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH
 
Thank you

Thank you - it works great!

The only difference for PHP 5.2.17 though is that it complains "PHP Warning: PHP Startup: Suhosin Extension does not officially support PHP 5.2 and below anymore, because it is discontinued. Use it at your own risk."

The solution is to use the previous version of Suhosin i.e. v0.9.31
 
Thanks, this worked :)

I was forced to use the extension instead of the patch because I cannot seem to get the patch to work with PHP 5.4.13
 
Back
Top