Doubts about php compressed package version, apache compressed package version, mysql. compressed package version in Window10
WangKeJun
WangKeJun 2020-03-21 16:16:01
0
0
830

Environment In Window10, php compressed package version, apache compressed package version, mysql. compressed package version or run the installation version, sometimes you will encounter strange problems when using PHP to connect to MySQL configuration:

PHP to connect to MySQL configuration in windows Sometimes we encounter strange problems: the apache server can be enabled normally, the php code can also run normally, and MySQL can also be used, but the error when connecting to MySQL using the PHP code is as follows:

Use pdo to connect to the test code

<?php

try {

$con= new PDO("mysql:host=localhost","root","password");

echo " Connection successful";

}

catch(PDOException $e)

{

echo $e->getMessage();

}

?>

An abnormal prompt could not be found during operation

Use mysqli_connect to connect the test code

<?php

$con= mysqli_connect("localhost","root1","password");

if ($con->connect_error) {

die("Connection failed: " . mysqli_connect_error());

}

echo "Connection successful";

?>

An abnormal prompt appears during operation. Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in...

The statements in php.ini, extension=mysqli and extension=pdo_mysql, have been removed (removal means letting PHP enable this extension).

Use phpinfo() to check - write a file phpinfo.php (the content is <?php phpinfo(); ?>), then put this file in the website directory and open it in the browser

Loaded Configuration File (none),

PDO drivers no value

Solve the problem

WangKeJun
WangKeJun

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!