PHP Unable to load library module.so

PHP_Unable_to_load_library_module.soIf you see an error like the following in the Apache error_log log-file, you probably have CentOS 6.4 which has a mistake in the mcrypt configuration file (If you need to find out what version of CentOS or RedHat you are running, check the content of the “/etc/redhat-release” file).

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/module.so' - /usr/lib/php/modules/module.so: cannot open shared object file: No such file or directory in Unknown on line 0

The solution for this error is to change the mcrypt.ini configuration file. The following commands will create a backup of the file before changing the content of the file. The second command will change the extension’s file-name from “module.so” to “mcrypt.so”.

Advertisements
$ cp /etc/php.d/mcrypt.ini /etc/php.d/mcrypt.ini.original
$ cat /etc/php.d/mcrypt.ini.original | sed 's/extension=module\.so/extension=mcrypt\.so/' >/etc/php.d/mcrypt.ini

If you prefer, you can of course perform the change in the file by using your favourite editor as well. After changing the settings, the web-server needs to be restarted. This is done with the following command:

$ /etc/init.d/httpd restart

Checking the log-file now will show no new lines like the one above.


Read more of my posts on my blog at http://blog.tinned-software.net/.

This entry was posted in Linux Administration, PHP and tagged , . Bookmark the permalink.