PDO sqlsrv for PHP 7.3
Some time you need old-school... So, PDO sqlsrv for PHP 7.3 on Centos 7
Example what I need to make alive
https://docs.microsoft.com/en-us/sql/connect/php/microsoft-php-driver-for-sql-server
https://packages.microsoft.com/rhel/7/prod/
Install PHP 7.3.14 from Remi (I configure php from remi different then is described in documentation, I'll write HowTo and why)
Example what I need to make alive
... $mssql = new PDO('sqlsrv:database=$database;server=$server,$port',$username,$password); ...For the first - big surprise and present for me from MS. Good documentation and no broken links... Respect!
https://docs.microsoft.com/en-us/sql/connect/php/microsoft-php-driver-for-sql-server
https://packages.microsoft.com/rhel/7/prod/
Install PHP 7.3.14 from Remi (I configure php from remi different then is described in documentation, I'll write HowTo and why)
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo ACCEPT_EULA=Y yum install -y epel-release msodbcsql17 mssql-tools unixODBC-devel php-pear php-devel pecl channel-update pecl.php.net pecl install sqlsrv pdo_sqlsrvINI files for PHP
echo "extension=pdo_sqlsrv.so" >> /etc/php.d/30-pdo_sqlsrv.ini echo "extension=sqlsrv.so" >> /etc/php.d/30-pdo_sqlsrv.iniAnd that all. Work fine.
# php -i | grep -i sqlsrv /etc/php.d/30-pdo_sqlsrv.ini, Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, sqlsrv, zip PDO drivers => dblib, mysql, sqlite, sqlsrv pdo_sqlsrv pdo_sqlsrv support => enabled pdo_sqlsrv.client_buffer_max_kb_size => 10240 => 10240 pdo_sqlsrv.log_severity => 0 => 0 sqlsrv sqlsrv support => enabled sqlsrv.ClientBufferMaxKBSize => 10240 => 10240 sqlsrv.LogSeverity => 0 => 0 sqlsrv.LogSubsystems => 0 => 0 sqlsrv.WarningsReturnAsErrors => On => On
Comments
Post a Comment