我不知道如何连接微软SQL 2014数据库上分体8使用菲律宾比索7.4。我发现GitHub 链接并下载了CentOS8-7.4.tar 并提取了php_sqlsrv_72_ts.so和php_pdo_sqlsrv_72_ts.so。但不确定在哪里粘贴模块,例如
windows => xampp 文件夹 > php >> 扩展
编辑 php.ini; Extension=php_sqlsrv_72_ts 并重新启动 Web 服务器
非常感谢任何帮助或指导。这是我运行的命令:
dnf -y update
dnf install yum-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
dnf module reset php
dnf module enable php:remi-7.4
yum module reset nginx
yum module enable nginx:1.16
dnf install wget nginx php-fpm mariadb-server php-mysqli php-gd php-imap php-xml php-mbstring php-intl php-pecl-apcu php-opcache php-pecl-zip
systemctl enable --now nginx php-fpm mariadb
firewall-cmd --permanent --zone=public --add-service=http --add-service=https
firewall-cmd --reload
PHP:
<?php
$serverName = "ServerIP\Instance";
$connectionInfo = array( "Database"=>"dummydatabase", "UID"=>"sa", "PWD"=>"mystrongpasswrod",'ReturnDatesAsStrings'=> true);
$conn = sqlsrv_connect( $serverName, $connectionInfo );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
else{
echo 'Successfully Connected';
}
答案1
明白了,运行以下命令:
dnf install php-pear php-devel unixODBC-devel make
pecl install sqlsrv pdo_sqlsrv
#https://packages.microsoft.com/rhel/8/prod/
dnf -y install https://packages.microsoft.com/rhel/8/prod/msodbcsql17-17.6.1.1-1.x86_64.rpm
echo 'extension=pdo_sqlsrv.so' > /etc/php.d/30-pdo_sqlsrv.ini
echo 'extension=sqlsrv.so' > /etc/php.d/30-sqlsrv.ini
setsebool -P httpd_can_network_connect_db 1