Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

windows - Call to undefined function mysql_connect

I just installed PHP and Apache on my home PC. When I try to call function mysql_connect I get:

fatal error: call to undefined function mysql_connect.

I have loaded php.ini where I have uncommented lines extension=php_mysql.dll and extension=php_mysqli.dll and changed extension directory to extension_dir = "C:phpext" - which is the directory where files php_mysql.dll and php_mysqli.dll are. How can I fix this problem?

Output of phpinfo(): http://jsfiddle.net/MMTwA/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After looking at your phpinfo() output, it appears the mysql extensions are not being loaded. I suspect you might be editing the wrong php.ini file (there might be multiple copies). Make sure you are editing the php file at C:phpphp.ini (also check to make sure there is no second copy in C:Windows).

Also, you should check your Apache logs for errors (should be in the logs directory in your Apache install.

If you haven't read the below, I would take a look at the comments section, because it seems like a lot of people experience quirks with setting this up. A few commenters offer solutions they used to get it working.

http://php.net/manual/en/install.windows.extensions.php

Another common solution seems to be to copy libmysql.dll and php_mysql.dll from c:PHP to C:WindowsSystem32.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...