• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Native support to SQL Server

Marcio Nunes

Basic Pleskian
Lost one customer because Plesk don't allow connect to external SQL Server.

Don't have any module to PHP 7 that work with plesk. I test many methods.
PDO, MSSQL and others.. without success!

Is very normal external connections to view specific data internal from business.
SQL server Microsoft is popular BBDD to CRM and database intranet.
 
Sorry. Forget mention Linux.
This feature is important to Plesk Linux. 90% small business use WordPress or Joomla web.
 
Did you try to use Microsoft Drivers for PHP for SQL Server - GitHub - Microsoft/msphpsql at PHP-7.0-Linux ?
I have installed in on Plesk 17.5 without any problems:

# yum install gcc make plesk-php71-devel unixODBC-devel
# /opt/plesk/php/7.1/bin/pecl install sqlsrv
# /opt/plesk/php/7.1/bin/pecl install pdo_sqlsrv
# echo "extension=sqlsrv.so" > /opt/plesk/php/7.1/etc/php.d/sqlsrv.ini
# echo "extension=pdo_sqlsrv.so" > /opt/plesk/php/7.1/etc/php.d/pdo_sqlsrv.ini
# plesk bin php_handler --reread

# /opt/plesk/php/7.1/bin/php -m | grep sqlsrv
pdo_sqlsrv
sqlsrv
 
Try to use plesk-php71-dev and unixodbc-dev names for these packages.
 
First test dont show "$numRegistros", but whitout errors. I need confirm with my customer the data connect MSSQL.

<?php
$dbhost = "xxxxxxxxxxxxxx"; #Nome do host
$db = "xxxx"; #Nome do banco de dados
$user = "xxxx"; #Nome do usuário
$password = "xxxx"; #Senha do usuário

$conninfo = array("Database" => $db, "UID" => $user, "PWD" => $password);
$conn = sqlsrv_connect($dbhost, $conninfo);

$instrucaoSQL = "SELECT id,Codigo from VEtapas WHERE CodPerletivo = 2017 order by Codigo";

$params = array();
$options =array("Scrollable" => SQLSRV_CURSOR_KEYSET);
$consulta = sqlsrv_query($conn, $instrucaoSQL, $params, $options);
$numRegistros = sqlsrv_num_rows($consulta);

echo "Esta tabela contém $numRegistros registros!\n<hr>\n";

?>

phpinfo load this:

sqlsrv support enabled
ExtensionVer 4.0.8.0
Directive Local Value Master Value
sqlsrv.ClientBufferMaxKBSize 10240 10240
sqlsrv.LogSeverity 0 0
sqlsrv.LogSubsystems 0 0
sqlsrv.WarningsReturnAsErrors On On
pdo_sqlsrv

pdo_sqlsrv support enabled
ExtensionVer 4.0.8.0
Directive Local Value Master Value
pdo_sqlsrv.client_buffer_max_kb_size 10240 10240
pdo_sqlsrv.log_severity 0 0
 
Ok!
Try with PDO could not find driver, but mssql "work" whitout errors and dont show any request from MSSQL.
This is issue from Plesk or Microsoft?
 
Back
Top