开发者

MySQL refuses to work with Apache 2.2 and PHP 5.2 on Windows 7 or Win2k3

MySQL refuses to work with Apache 2.2 and PHP 5.2.

I have been working with a friend who is trying to get this to work on Windows 7 64bit and I have been trying on Windows 2003 Server and we both have the same problem - MySQL will not be recognized. From the command line MySQL works fine, but PHP and/or Apache will not load the MySQL modules.

phpinfo() does not show it is installed. Apache and PHP work fine.

Anyone hav开发者_如何学Pythone any ideas? Be aware that I have already been on at least 100 sites and have read 100's of articles on how to fix this. So I am looking for concrete info on this, not speculation.

No insults to anyone intended, but after 3 days and long distance calls to California from Ontario, I need results before I go broke and go insane.


Look for php\ext\php_mysqli.dll on your filesystem (this is the path in the xampp install). It's only PHP that needs this module, Apache only needs to execute PHP. So check you have

extension=php_mysql_libmysql.dll

in php\php.ini. along with a config section for MySQL

[MySQLi]
mysqli.allow_local_infile = On
mysqli.allow_persistent = Off
mysqli.cache_size = 2000
mysqli.max_persistent = -1
mysqli.max_links = -1
mysqli.default_port = 3306
...

What errors do you get trying to use the mysqli_query() etc functions?

If you really can't get it working, the excellend xampp will install a full *AMP stack on your OS of choice with very little hassle.

edit: @Beauford if the function's undefined then the library is not loaded. Follow above instructions for MySQLi, if in this still doesn't work package installation steps are here along with a perhaps relevant Win7 troubleshooting guide in the comments (copied verbatim):

to enable the mysql_... and mysqli_... functionality, i opened the php.ini file to uncomment the following lines:

;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_pdo_mysql.dll

but phpinfo() still stated that no mysql extensions were loaded. i tried the fixes and suggestions above with no success. so i invoked the windows shell and typed ("Path" environment variable set to the PHP & MySQL directories): php.exe -m

this returned the following error: PHP Startup: Unable to load dynamic library 'C:\php5\php_mysql.dll' - Module not found.

this told me that PHP didn't recognize what i thought was the extensions directory. it searched all other places first (sys-dir, workin'-dir, the MySQL "bin" dir because of the "Path" variable set, and even a curious directory "C:\php5" that doesn't even exist on my mashine) but not the expected "ext" directory.

so the fix was to go to "php.ini" again and uncomment the following line:

;extension_dir="ext"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜