hello
how to add extension sqlsrv & pdo_sqlsrv to php (nginx)
thx
how to add extension sqlsrv & pdo_sqlsrv to php (nginx)
- Edited
Here take php73 as an example
Install the driver
yum install msodbcsql mssql-tools unixODBC-devel
Download pdo_sqlsrv extension package
wget http://pecl.php.net/get/pdo_sqlsrv-5.3.0.tgz
Unzip
tar -zxvf pdo_sqlsrv-5.3.0.tgz
Enter the decompression directory
cd pdo_sqlsrv-5.3.0
Excuting an order
/www/server/php/73/bin/phpize
./configure --with-php-config=/www/server/php/73/bin/php-config
Compile and install
make && make install
Update php.ini
Modify /www/server/php/73/etc/php.ini to find: extension =
then the last extension add extension = "pdo_sqlsrv.so"
didn't work, I have Ubuntu 18.04
i tried this code from microsoft
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv
sudo su
printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/7.3/mods-available/sqlsrv.ini
printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/7.3/mods-available/pdo_sqlsrv.ini
exit
sudo phpenmod -v 7.3 sqlsrv pdo_sqlsrv
I even changed /etc/php/7.3/mods-available/ to /www/server/php/73
xXxlazharxXx pecl is not included in aapanel, so you have to folow above comment
- Edited
This sort of work, you need to enable microsoft's repo first otherwise you won't be able to install msodbcsql
. For CentOS7 it is:
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
And after you are done, you will have to use PDO instead of sqlsrv to connect.
aaPanel_Jose
While following your instruction, I got this error:
configure: error: invalid variable name: `'
How to fix this?
aaP_andresberry01
Hello, please take a screenshot or provide more details.
aaPanel_Kern
Look like this..
aaP_andresberry01
Replace it with this: there is an extra space above
./configure --with-php-config=/www/server/php/80/bin/php-config
aaPanel_Kern
It works... Thank you
Ultraman Hey, i am getting this error https://prnt.sc/nTp4vp-K0SzL . Could you help me please?
Please share steps for how to add sqlsrv or mssql extension add in php7.0 version.
OS:- 20.04.4 LTS (Focal Fossa)
aaPanelLinux panel used.
what extension should I install?
Thanks
Hello, please install the extension according to your website program