日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

记-php连接mssql遇上的问题

發布時間:2024/10/12 php 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 记-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

  根據提示信息進入到:?http://go.microsoft.com/fwlink/?LinkId=163712頁面,在根據你的服務器所屬操作系統,里面有完整的操作步驟說明;

  下面是linux(redhat)下來進行的操作設置:

    

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 su
wget 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-rpms
sudo yum install devtoolset-7
scl enable devtoolset-7 bash

Step 3. Install the PHP drivers for Microsoft SQL Server

sudo pecl install sqlsrv
sudo 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 sqlsrv
tar 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-sqlsrv

Step 4. Install Apache

sudo yum install httpd

SELinux 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 1

Step 5. Restart Apache and test the sample script

sudo apachectl restart

To 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

    

    

?

轉載于:https://www.cnblogs.com/leonchan/p/11301425.html

總結

以上是生活随笔為你收集整理的记-php连接mssql遇上的问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。