Php links to mysql. I 'd like to ask you how to print the php configuration information. apache can also be started normally, and mysql can also be logged in. Why can't I connect to a test php link database, I am a newbie. please answer the following questions: test code:
$ Host = 'localhost ';
$ User_name = 'root ';
$ Password = '000000 ';
$ Conn = mysql_connect ($ host, $ user_name, $ password );
If (! $ Conn)
{
Die ('database connection failed ');
}
Echo 'database connection successful! ';
If (mysql_close ($ conn ))
{
Echo'
...
';
Echo 'The connection to the database has been closed successfully ';
}
?>
Run error prompt: Fatal error: Call to undefined function mysql_connect () in E: \ Tools \ httpd-2.2.19-win64 \ httpd-2.2-x64 \ htdocs \ index.html on line 7
However, I am right about the user name and password. I can log on as well!
Code for testing php configuration information:
Phpinfo ();
?>
This can output php pest information;
After several hours, I still can't do anything about it.
Reply to discussion (solution)
Nobody? Online, I just waited until dawn.
In phpinfo, there is no mysql. open the php. ini configuration file, remove the semicolon before extension = php_mysql.dll, save it, and restart Apache.
Nobody? Online, I just waited until dawn.
Solution No ???
Extension = php_mysql.dll
Extension = php_mysqli.dll
Extension = php_oci8.dll
Extension = php_openssl.dll
All done.
I also found that when I run php.exe, the system prompts that it cannot be started and OCI. dll is lost in the computer. what does that mean?
What about the database name?
You can leave the database name empty. $ con = mysql_connect ("localhost", "mysql_user", "mysql_pwd ");
W3c example.
By the way, I found a problem. now I switched to WampServer for integration. I used WampServer to test the test file, but it still cannot be linked. so I set the password to null, the connection is successful. when I click Mysql console, I will be prompted to enter the password, which proves that I have set the password and I set the password when installing mysql, I am confused. now I quit WampServer. the same code can be successfully connected under WampServer. it is not successful if I use apache + mysql + php to establish a connection, if the password is blank or the connection is unsuccessful, the header is too big. I have configured it twice, alas ................
Undefined function mysql_connect
Obviously, php_mysql does not load or fails to load.
Comment out extension = php_oci8.dll
Since you don't need oracle, why open it? If you really need to use oracle, how do you not know how to install the oracle client?
Do not verify the working status of mysql in two integration environments. In the integration environment, mysql is affiliated with the integration environment and does not exist as a separate service.
This means that mysql can be used in an integrated environment, but not in the other, it is extremely normal.
Php_mysql requires the mysql support library in the php installation directory, so you need to place the php installation directory in the search path of the operating system
The green method is to add LoadFile "php installation path/php5ts. dll" to httpd. conf"
Php5ts. dll
Can this LoadFile "php installation path/php5ts. dll" be placed at httpd. conf? For the first time I configured this item, I don't know much about it.
$ Conn = mysql_connect ('127. 0.0.1 ', 'root', '123 ');
If (! $ Conn)
{
Die ('database connection failed'. mysql_error ());
}
Echo 'database connection successful! ';
If (mysql_close ($ conn ))
{
Echo 'The connection to the database has been closed successfully ';
}
?>
Fatal error: Call to undefined function mysql_connect () in E: \ Tools \ httpd-2.2.19-win64 \ httpd-2.2-x64 \ htdocs \ testmysql.html on line 4
Are you sure you have seen mysql extensions in phpinfo ()?
In the httpd. conf file, add the following statement to LoadModule php5_module "c:/php/php5apache2_2.dll:
PHPIniDir "c:/php"
LoadModule php5_module "E:/Tools/PHP/php-5.2.5 (x64)/php5apache2_2.dll"
PHPIniDir "E: \ Tools \ PHP"
This is my