How to get rid of "PHP Warning: PHP Startup:
Unable to load dynamic library '/usr/lib/php5/20090626/suhosin.so'"
on Debian GNU / Linux
After a recent new
Debian Squeeze Apache+PHP server install
and moving a website from another server host running on
CentOS
5.7 Linux server, some of the PHP scripts running via
crontab started displaying the following annoying
PHP
Warnings :
debian:~# php /home/website/www/cron/update.php
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20090626/suhosin.so' -
/usr/lib/php5/20090626/suhosin.so: cannot open shared object file:
No such file or directory in Unknown on line 0
Obviously the error revealed that PHP cli is not happy that, I've
previously removes the suhosin
php5-suhosin module from the
system.
I wouldn't have removed
php5-suhosin if sometimes it doesn't
produced some odd experiences with the Apache webserver.
To fix the PHP Warning, I used first grep to see, where exactly the
suhosin module gets included in debian's php.ini config files.
debian:~# cd /etc/php5
debian:/etc/php5# grep -rli suhosin *
apache2/conf.d/suhosin.ini
cgi/conf.d/suhosin.ini
cli/conf.d/suhosin.ini
conf.d/suhosin.ini
Yeah that's right Debian has three php.ini php config files. One
for the
php cli -
/usr/bin/php, another for the
Apache webserver loaded php library -
/usr/lib/apache2/modules/libphp5.so and one for
Apache's
cgi module -
/usr/lib/apache2/modules/mod_fcgid.so
.
I was too lazy to edit all the above found declarations trying to
include the suhosin module in PHP, hence I remembered that probably
all this obsolete
suhosin module declaration are still
present because probably the
php5-suhosin package is still
not purged from the system.
A quick check with
dpkg , further strenthened my assumption
as the
php5-suhosin module was still hanging around as an
(
rc - remove candidate);
debian:~# dpkg -l |grep -i suhosin
rc php5-suhosin 0.9.32.1-1 advanced protection module for
php5
Hence to remove the obsolete package config and directories
completely out of the system and hence solve the PHP Warning I used
dpkg --purge, like so:
debian:~# dpkg --purge php5-suhosin
(Reading database ... 76048 files and directories currently
installed.)
Removing php5-suhosin ...
Purging configuration files for php5-suhosin ...
Processing triggers for libapache2-mod-php5 ...
Reloading web server config: apache2.
Further on to make sure the PHP Warning is solved I did the cron
php script another go and it produced no longer errors:
debian:~# php /home/website/www/cron/update.php
debian:~#