PHP configuration mysql and how to test the success of configuring the database. Friends in need can refer to it.
If you are configuring php mysql apache for the first time, how do we test whether php connects to the database successfully? Just create a test.php file and save the following code to the file.
The code is as follows
|
Copy code
|
||||
$link=mysql_connect("localhost","root","12345"); //Change 12345 to your mysql password if(!$link) echo "Failed!"; else echo "Success!";mysql_close(); ?>
Open http://localhost/test.php in the browser
Success means your configuration is successful. If it fails, we can use mysql_connect("localhost","root","12345") or die( mysql_error()); and there will be an error message. | If it prompts that the mysql_connect function is not defined, we can configure it in php.ini as shown below
http://www.bkjia.com/PHPjc/630737.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630737.htmlTechArticlePHP configuration mysql and how to test the successful configuration of the database. Friends in need can refer to it. If you are configuring php mysql apache for the first time, how do we test that php successfully connects to the database...