1. odbc install
yum install msodbcsql17
yum install mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
[설치 안될경우]
(centos7 mssql odbc 드라이버 셋팅)
#wget https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
#rpm -Uvh msodbcsql17-17.0.1.1-1.x86_64.rpm
(centos7 mstool 셋팅)
#wget https://packages.microsoft.com/rhel/7/prod/mssql-tools-17.0.1.1-1.x86_64.rpm
#rpm -Uvh mssql-tools-17.0.1.1-1.x86_64.rpm
기본 모듈 unixODBC 설치
yum install unixODBC-devel
2. sqlsrv 다운로드 하여 설치한다
#wget https://pecl.php.net/get/sqlsrv-5.8.0.tgz
#tar xvpfz sqlsrv-5.8.0.tgz
#cd sqlsrv-5.8.0
#/usr/local/php/bin/phpize
#./configure --with-php-config=/usr/local/php/bin/php-config
#make && make install
3. pdo_sqlsrv install
#wget https://pecl.php.net/get/pdo_sqlsrv-5.8.0.tgz
#tar xvf pdo_sqlsrv-5.8.0.tgz
#cd pdo_sqlsrv-5.8.0
#/usr/local/php/bin/phpize
#./configure --with-php-config=/usr/local/php/bin/php-config
#make && make install
4. 모듈위치 확인
#cd /usr/local/php/lib/php/extensions/no-debug-zts/
opcache.so pdo_sqlsrv.so sqlsrv.so
5. php.ini 에서 링크
#vi /usr/local/php/lib/php.ini (php.ini 설치 위치에서 오픈하여 아래 두줄을 맨아래 넣고 저장)
extension=/usr/local/php/lib/php/extensions/no-debug-zts/sqlsrv.so
extension=/usr/local/php/lib/php/extensions/no-debug-zts/pdo_sqlsrv.so
6. 아파치 재시작
#/usr/local/apache/bin/apachectl restart
이나
#systemctl restart httpd