我无法通过PHP连接到mysql.它生成[error] [client 127.0.0.1] PHP警告:MysqL_connect():在PHP中执行MysqL_connect()函数时,在apache错误日志中没有此类文件或目录错误消息.
运行PHP -m命令时请查看警告消息:
$PHP -m | grep MysqL
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/PHP/extensions/no-debug-non-zts-20090626/msql.so' - dlopen(/usr/lib/PHP/extensions/no-debug-non-zts-20090626/msql.so, 9): image not found in UnkNown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/PHP/extensions/no-debug-non-zts-20090626/PHP_MysqL.dll' - dlopen(/usr/lib/PHP/extensions/no-debug-non-zts-20090626/PHP_MysqL.dll, 9): image not found in UnkNown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/PHP/extensions/no-debug-non-zts-20090626/PHP_MysqLi.dll' - dlopen(/usr/lib/PHP/extensions/no-debug-non-zts-20090626/PHP_MysqLi.dll, 9): image not found in UnkNown on line 0
MysqL
MysqLi
MysqLnd
pdo_MysqL
和
$MysqLadmin -h `hostname` --port=3306 version
/usr/local/MysqL/bin/MysqLadmin: connect to server at 'heapzero.local' Failederror: 'Host '192.168.1.36' is not allowed to connect to this MysqL server'
PHP版本:
$PHP --version
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/PHP/extensions/no-debug-non-zts-20090626/msql.so' - dlopen(/usr/lib/PHP/extensions/no-debug-non-zts-20090626/msql.so, 9): image not found in UnkNown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/PHP/extensions/no-debug-non-zts-20090626/PHP_MysqL.dll' - dlopen(/usr/lib/PHP/extensions/no-debug-non-zts-20090626/PHP_MysqL.dll, 9): image not found in UnkNown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/PHP/extensions/no-debug-non-zts-20090626/PHP_MysqLi.dll' - dlopen(/usr/lib/PHP/extensions/no-debug-non-zts-20090626/PHP_MysqLi.dll, 9): image not found in UnkNown on line 0
PHP 5.3.2 (cli) (built: Aug 7 2010 00:04:41)
copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, copyright (c) 1998-2010 Zend Technologies
MysqL版本:
MysqL --version
/usr/local/MysqL/bin/MysqL Ver 14.14 distrib 5.1.50, for apple-darwin10.3.0 (i386) using readline 5.1
我花了很多时间来解决这个问题.请指教!谢谢!
解决方法: