解決 PHP 載入 dll 模組出錯的問題
來源:互聯網
上載者:User
如何解決“PHP startup: Unable to load dynamic library”的錯誤?
怪啦!今天的Apache和IIS都沒法正確載入php_mysql.dll。google了一下,原來發現出現這個問題的人還不少,PHP startup: Unable to load dynamic library :E;/PHP5/ext/php_mysql.dll。明明php_mysql.dll就擺在extension_dir (= "E:/PHP5/ext")下的嘛,怎麼會呢?而且就在php_mysql.dll之前的extension=php_gd2.dll都沒有出現這個問題,怪了!有人說copy libmysql.dll到 %windir%/system32下就可以解決問題,其實不是就這一個辦法:
PHP被我挪了個窩,%ProgramFiles%到E:/下,導致一些要依賴於其他dll才能工作的擴充無法正常載入這些dll,出現載入擴充出錯,以剛才的php_mysql.dll為例,php_mysql依賴libmysql.dll,由於給PHP5挪窩了,而又沒有把新的E:/PHP5夾道%PATH%中去,所以沒法找到這個libmysql.dll,才會出錯。所以為了能夠使用這些mysql的擴充,除了要正確地配置extension_dir外,還得保證系統能夠這些擴充所依賴的dll,解決的辦法有兩個: 1,將這些依賴的dll拷貝到%windir%/system32下
2,或者將PHP5的安裝目錄添加到%PATH%中。
無論那個都可以很好地達到我們地目的。夠簡單的,但是有時候還就想不到哪兒去。 到底哪些擴充依賴哪些dll呢?以下列表可以協助我們回答這個問題: php_curl.dll CURL, Client URL library functions 要求: libeay32.dll, ssleay32.dll (bundled)
php_domxml.dll DOM XML functions PHP <= 4.2.0 要求: libxml2.dll
(bundled) PHP >= 4.3.0 要求: iconv.dll (bundled)
php_fdf.dll FDF: Forms Data Format functions. 要求: fdftk.dll
gnu_gettext.dll (bundled), PHP >= 4.2.3 要求 libintl-1.dll,
php_iconv.dll ICONV characterset conversion 要求: iconv-1.3.dll
php_ingres.dll Ingres II functions 要求: Ingres II libraries
php_interbase.dll InterBase functions 要求: gds32.dll (bundled)
php_java.dll Java functions PHP <= 4.0.6 要求: jvm.dll (bundled)
php_ldap.dll LDAP functions PHP <= 4.2.0 要求 libsasl.dll(bundled),
PHP >= 4.3.0 要求 libeay32.dll,ssleay32.dll (bundled)
php_mcrypt.dll Mcrypt Encryption functions 要求: libmcrypt.dll
php_mhash.dll Mhash functions PHP >= 4.3.0 要求: libmhash.dll (bundled)
php_mcrypt.dll Mcrypt Encryption functions 要求: libmcrypt.dll
php_mhash.dll Mhash functions PHP >= 4.3.0 要求: libmhash.dll (bundled)
php_msql.dll mSQL functions 要求: msql.dll (bundled)
php_mssql.dll MSSQL functions 要求: ntwdblib.dll (bundled)
php_mysql.dll MySQL functions PHP >= 5.0.0, 要求 libmysql.dll (bundled)
php_mysqli.dll MySQLi functions PHP >= 5.0.0, 要求 libmysqli.dll (bundled)
php_oci8.dll Oracle 8 functions 要求: Oracle 8.1+ client libraries
php_openssl.dll OpenSSL functions 要求: libeay32.dll (bundled)
php_oracle.dll Oracle functions 要求: Oracle 7 client libraries
php_sybase_ct.dll Sybase functions 要求: Sybase client libraries
php_xmlrpc.dll XML-RPC functions PHP >= 4.2.1 要求: iconv.dll (bundled)
php_xslt.dll XSLT functions PHP <= 4.2.0 要求 sablot.dll, expat.dll (bundled).
PHP >= 4.2.1 要求 sablot.dll, expat.dll, iconv.dll (bundled). 以上是轉載網上的。
以下是自己的一點經驗:
對於php5,設定檔php.ini放到 */apache2/bin/ 目錄下是沒有任何問題的,不需要放到作業系統的目錄裡。
對於上述問題,我的處理方式是將php的目錄如";D:/grams/Apache2/php511"添加到系統變數 path裡。分號是為了與其他參數分隔。
或者將php目錄裡的libmysql.dll拷貝到*/apache2/bin/ 目錄裡。
在增加 %php%到path中後,需重啟電腦, 登出是沒有用的。