apache-php安装mysql简单方法

时间:2021-11-28 08:51:33

1.启用mysql功能,php.ini

extension=php_mysql.dll

extension=php_mysqli.dll

2. 修改extension_dir = "ext",去掉前面的“;”,并改成extension_dir ="ext路径",比如我是extension_dir = "E:/apache_php_mysql_appadmin/php-5.6.22-Win32-VC11-x64/ext"即可测试!

3.测试代码:

<?php

      $conn=mysql_connect("localhost","root","root");

       if($conn){

       echo "连接mysql数据库ok";

       }else{

              echo "连接数据库失败";

       }

?>