The Great god for help PHP connection MySQL, php.ini configuration issues

Source: Internet
Author: User
Like many people, there is no PHP connection, search the Internet a lot, have not resolved
First of my configuration: apache2.2.22 + php5.4.14 + MySQL 5.0
Error message:
Fatal error:call to undefined function mysql_connect () in C:\Program files\apache\htdocs\index.php on line 6


There are php.ini under Windows and configured
Extension=php_mysql.dll
Extension=php_mysqli.dll in front of;
My installation path is this:
Extension_dir = "C:/myenv/php-5.3.5/ext"
The path is all fine.

Put a. /mysql/bin/libmysql.dll Copy to php5.0 below, and copy to Php5.0/ext directory
LibmySQL.dll Php5ts.dll two files imported in Windows/system32



The http.conf in Apache is configured with the
#载入apache处理PHP模块, for PHP file configuration
LoadModule Php5_module C:/myenv/php-5.3.5/php5apache2_2.dll
#PHPIniDir用于指定PHP的ini文件
Phpinidir "c:/myenv/php-5.3.5"
AddType application/x-httpd-php. php. phtml

I have done my best, did not get out for a long while, depressed, seek Master rescue!!!


Reply to discussion (solution)

Add to the above:
MySQL can open, the code in index.php is as follows:
$conn =mysql_connect ("localhost", "root", "123456");
if ($conn) {
echo "Connect MySQL database successfully";
}else{
echo "Failed to connect to database";
}
?>

LZ's Php\ext directory under Php_mysql.dll and Php_mysqli.dll all right?

Yes, no problem, download the installation I haven't moved. Phpinfo () No problem.



How come no one answered???

1. It is recommended that LZ restart Apache each time the configuration is changed.
2.LZ See if there is MySQL56 in Windows (my name is, the LZ may not be the same version number) This service, whether it has been started.

What else is really unexpected.

Every time there is a reboot, the computer has been restarted several times, or is not effective
Is there MySQL56 in Windows? What is this service?
Don't understand.

I only have MySQL this service, this service is no problem.

So hard, it's better to just put on a wamp base environment

Wamp is too rigid, the version upgrade is not flexible. A single installation is not troublesome, just encountered a problem, it is necessary to solve.

Phpinidir "c:/myenv/php-5.3.5"
LoadFile "C:/myenv/php-5.3.5/php5ts.dll"
LoadModule php5_module "C:/myenv/php-5.3.5/php5apache2_2.dll"

Haven't solved, hey, not all Ah, Ben collapsed the amount

My God, or I have solved the code as follows:
LoadModule php5_module "D:/myblog/php/php5apache2_2.dll"
LoadFile "D:/myblog/php/php5ts.dll"
AddType application/x-httpd-php. php. phtml
Phpinidir "D:/myblog/php/php.ini"


This setting does not have to put php.ini under Windows, directly on the D:/myblog/php/php.ini is OK!
The key is this Phpinidir "D:/myblog/php/php.ini" [/b]
At the same time I also put Apache + PHP + MySQL in the same folder MyBlog below, better management. Hey.

Finally got out, hey really hard, thank you guys

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.