Home  >  Q&A  >  body text

Doubts about php compressed package version, apache compressed package version, mysql. compressed package version in Window10

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

WangKeJunWangKeJun1643 days ago781

reply all(0)I'll reply

No reply
  • Cancelreply