如何解决PHP startup: Unable to load dynamic library的错误
按照我前篇文章Apache+php+mysql安装图解安装完成后。重启Apache时提示无法正确加载php_mysql.dll。google了一下,网上有不少的文章写这个,即提示:PHP startup: Unable to load dynamic library './php_mysql.dll 找不到指定的模块。:D:\php\php-5.0.5-Win32\ext\php_mysql.dll。明明php_mysql.dll就摆在extension_dir (= "D:/php/php-5.0.5-Win32/ext")下的嘛,在环境变量里按图示设置的,没有错呀!怪了!有人说copy libmysql.dll到 %windir%\system32下就可以解决问题,试了下,再重启,还是没有用喔。晕死掉了。
php被我放在D盘,还是设置时还要加上什么目录什么的。还是环境变量没有设对?!%ProgramFiles%到D:\下,导致一些要依赖于其他dll才能工作的扩展无法正常加载这些dll,出现加载扩展出
错,以刚才的php_mysql.dll为例,php_mysql依赖libmysql.dll,由于给PHP挪窝了,而又没有把新的D:\PHP加到%PATH%中去
,所以没法找到这个libmysql.dll,才会出错。所以为了能够使用这些mysql的扩展,除了要正确地配置extension_dir外
,还得保证系统能够这些扩展所依赖的dll,解决的办法有两个:
1 将这些依赖的dll拷贝到%windir%\system32下
2 或者将PHP的安装目录添加到%PATH%中。
以上方面都不行时。我是用把PHP目录下的所有DLL复制到windir%\system32下
再试了下,还是不行
再把。php_mysql.dll 复制到windir%\system32下,
重启Apache,搞定!
总结如下:
1、extension_dir要设置正确。
2、把所依赖的dll拷贝到%windir%\system32
3、或者将PHP的安装目录添加到%path%中.
还是不行,就按我上面的方法
就是把那些。DLL 都复制到windir%\system32目录下。
应该是把php_mysql.dll和libmysql.dll就可以搞定了。
其它的方法类似。
就是把他本身的DLL和所依赖的DLL都COPY到windir%\system32目录中就行。
重启下就知道了。
够简单的.
到底哪些扩展依赖哪些dll呢?请看下面的列表:
php_curl.dll CURL, Client URL library functions Requires: libeay32.dll, ssleay32.dll (bundled)
php_domxml.dll DOM XML functions PHP <= 4.2.0 requires: libxml2.dll
(bundled) PHP >= 4.3.0 requires: iconv.dll (bundled)
php_fdf.dll FDF: Forms Data Format functions. Requires: fdftk.dll
gnu_gettext.dll (bundled), PHP >= 4.2.3 requires libintl-1.dll,
php_iconv.dll ICONV characterset conversion Requires: iconv-1.3.dll
php_ingres.dll Ingres II functions Requires: Ingres II libraries
php_interbase.dll InterBase functions Requires: gds32.dll (bundled)
php_java.dll Java functions PHP <= 4.0.6 requires: jvm.dll (bundled)
php_ldap.dll LDAP functions PHP <= 4.2.0 requires libsasl.dll(bundled),
PHP >= 4.3.0 requires libeay32.dll,ssleay32.dll (bundled)
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll (bundled)
php_mcrypt.dll Mcrypt Encryption functions Requires: libmcrypt.dll
php_mhash.dll Mhash functions PHP >= 4.3.0 requires: libmhash.dll (bundled)
php_msql.dll mSQL functions Requires: msql.dll (bundled)
php_mssql.dll MSSQL functions Requires: ntwdblib.dll (bundled)
php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll (bundled)
php_mysqli.dll MySQLi functions PHP >= 5.0.0, requires libmysqli.dll (bundled)
php_oci8.dll Oracle 8 functions Requires: Oracle 8.1+ client libraries
php_openssl.dll OpenSSL functions Requires: libeay32.dll (bundled)
php_oracle.dll Oracle functions Requires: Oracle 7 client libraries
php_sybase_ct.dll Sybase functions Requires: Sybase client libraries
php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 requires: iconv.dll (bundled)
php_xslt.dll XSLT functions PHP <= 4.2.0 requires sablot.dll, expat.dll (bundled).
PHP >= 4.2.1 requires sablot.dll, expat.dll, iconv.dll (bundled).