Unable to initialize module的php错误的原因通常是因为模块和php的版本不一致导致的。例如下面错误:
[[email protected]]# php -v
PHP Warning: PHP Startup: mhash: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
PHP 5.2.17 (cli) (built: Feb 19 2011 11:52:47)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
[[email protected]]# yum list installed | grep php-mhash
php-mhash.i386 5.1.6-15.el5.centos.1 installed
明显,mhash模块版本5.1.6和php的版本5.2.17不一致
解决办法,吧mhash模块升级到对应的php版本
[[email protected]]# yum --enablerepo=webtatic --exclude=php*5.3* update -y php-mhash
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.steadfast.net
* extras: mirrors.gigenet.com
* updates: mirror.ubiquityservers.com
webtatic | 951 B 00:00
webtatic/primary | 42 kB 00:00
webtatic 229/229
Excluding Packages in global exclude list
Finished
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package php-mhash.i386 0:5.2.17-1.1.w5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================
Updating:
php-mhash i386 5.2.17-1.1.w5 webtatic 20 k
Transaction Summary
=================================================================================================================================================================================
Install 0 Package(s)
Upgrade 1 Package(s)
Total download size: 20 k
Downloading Packages:
php-mhash-5.2.17-1.1.w5.i386.rpm | 20 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : php-mhash 1/2
Cleanup : php-mhash 2/2
Updated:
php-mhash.i386 0:5.2.17-1.1.w5
Complete!