记-php连接mssql遇上的问题
(1) This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: http://go.microsoft.com/fwlink/?LinkId=163712
根據(jù)提示信息進(jìn)入到:?http://go.microsoft.com/fwlink/?LinkId=163712頁(yè)面,在根據(jù)你的服務(wù)器所屬操作系統(tǒng),里面有完整的操作步驟說明;
下面是linux(redhat)下來進(jìn)行的操作設(shè)置:
Installing the drivers on Red Hat 7
[!NOTE] To install PHP 7.1 or 7.2, replace remi-php73 with remi-php71 or remi-php72 respectively in the following commands.
Step 1. Install PHP
sudo suwget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
subscription-manager repos --enable=rhel-7-server-optional-rpms
yum install yum-utils
yum-config-manager --enable remi-php73
yum update
yum install php php-pdo php-xml php-pear php-devel re2c gcc-c++ gcc
Step 2. Install prerequisites
Install the ODBC driver for Red Hat 7 by following the instructions on the Linux and macOS installation page.
Compiling the PHP drivers with PECL with PHP 7.2 or 7.3 requires a more recent GCC than the default:
sudo yum-config-manager --enable rhel-server-rhscl-7-rpmssudo yum install devtoolset-7
scl enable devtoolset-7 bash
Step 3. Install the PHP drivers for Microsoft SQL Server
sudo pecl install sqlsrvsudo pecl install pdo_sqlsrv
sudo su
echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini
echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-sqlsrv.ini
exit
An issue in PECL may prevent correct installation of the latest version of the drivers even if you have upgraded GCC. To install, download the packages and compile manually (similar steps for pdo_sqlsrv):
pecl download sqlsrvtar xvzf sqlsrv-5.6.0.tgz
cd sqlsrv-5.6.0/
phpize
./configure --with-php-config=/usr/bin/php-config
make
sudo make install
You can alternatively download the prebuilt binaries from the Github project page, or install from the Remi repo:
sudo yum install php-sqlsrvStep 4. Install Apache
sudo yum install httpdSELinux is installed by default and runs in Enforcing mode. To allow Apache to connect to databases through SELinux, run the following command:
sudo setsebool -P httpd_can_network_connect_db 1Step 5. Restart Apache and test the sample script
sudo apachectl restartTo test your installation, see Testing your installation at the end of this document.
(2)A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not
accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes
Provider, error: 40 - Could not open a connection to SQL Server)
這是mssql連接過程中,連接mssql ip地址不通
(3)code:08001
?
轉(zhuǎn)載于:https://www.cnblogs.com/leonchan/p/11301425.html
總結(jié)
以上是生活随笔為你收集整理的记-php连接mssql遇上的问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何正确洗涤窗帘,避免损坏?
- 下一篇: 浴室安装电热毛巾架要选择打孔的还是免打孔