天天看點

05.php_pdo引用不恰當libmysql.dll導緻Apache崩潰05.php_pdo引用不恰當libmysql.dll導緻Apache崩潰

在測試環境windows xp/2003+php v5.2.14+apache v2.2下,使用php_pdo對象試圖連接配接 mysql 資料庫服務時,apache的error.log中什麼也沒報告,httpd.exe 二話不說徑直崩潰。

在 php.ini 中注釋掉 extension=php_pdo.dll 後,apache則不再崩潰。

該環境在 %system32% 目錄下,曾放置過一個 libmysql.dll 。

經測試,apache加載的是此路徑下的 libmysql.dll 。

由于 libmysql.dll 檔案并沒有列出版本号,是以隻能通過檔案大小來判斷是哪一個版本的。

一般,php v5.2.14自帶的 libmysql.dll 檔案大小是2,076kb。

mysql v5.0 自帶的則是1,531kb。

mysql v5.5 cluster自帶的是2,703kb。

mysql v5.5 自帶的是4,168kb,并且已經有了版本号:5.5.5.0。

懷疑該環境 %system32% 目錄下的 libmysql.dll 檔案與apache v2.2+php v5.2.14不相容,是以用php自帶的 libmysql.dll 檔案替換,遂成。

[2009-06-22 01:53 utc] ramin dot farmani at gmail dot com

hi

similarly my httpd.exe crashed when i runnig a site wroten by yii framework it's seem we have a big problem in php_pdo_mysql library i using php 5.2.10

[2009-09-02 01:07 utc] parad0x dot ua at gmail dot com

i was able to fix this by removing mysql from windows' path env setting. looks like when php is looking for libmysql.dll it uses the first one it finds in mysql\bin and it's not quite compatible.

or you can try to add php to the path before mysql.

i hope that helps.

【注:此處建議,在系統變量path中,把php的目錄放在mysql\bin目錄前。】

[2009-09-02 07:45 utc] [email protected]

ok, it was then the classic case where mysql's libmysql dll was used instead of the version bundled with php. we already have many bogus reports about this issue and your solution is the right one (as explain in the other reports).

【注:此處認為這是一個經典的場景,把mysql自帶的libmysql替換php自帶的,導緻不相容悲劇。】