PHP Installation of pdo_sqlsrv extension (CentOS7)
I. Installing related dependencies1.1 Installing Microsoft Sources$ curl -s -o /tmp/prod.repo https://packages.microsoft.com/config/rhel/7/prod.repo
1.2 Prevent conflicts by uninstalling the original version first (optional)$ yum remove -y unixODBC
1.3 Install the driver (all three should be installed, one cannot be missing)$ yum install -y msodbcsql mssql-tools unixODBC-devel
II. Compile pdo_sqlsrv plugin2.1 Download pdo_sqlsrv extension package$ wget http://pecl.php.net/get/pdo_sqlsrv-5. ...
PHP 无法连接 MySQL 问题
问题描述今天在一台新的服务器中安装了php7.2,mysql-5.6后。测试用php连接mysql时发现无论如何php都连接不上mysql数据库,排除了数据库账号错误,并且php已经安装了连接数据库的mysqlnd扩展。
错误排查使用php连接测试脚本,查看到底是什么错误导致php连接不上mysql的。
以下是php连接mysql的php测试脚本db-connect-test.php
<?php$dbname = 'mysql';$dbuser = 'root';$dbpass = '1234';$dbhost = 'localhost';$connect=mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);// 检查连接if (!$connect){ die("连接错误: " . mysqli_connect_error());} die("连接成功...\n");?>
...