How to install and configure the connection to mssql in php8.2?
Hello, I want to connect to a mssql database but I don't know how to install and activate the extensions for myvesta, can someone please help me?
Last edited by kziel on Sat Jun 24, 2023 12:16 pm, edited 1 time in total.
Tags:
- myVesta
- Site Admin
- Posts: 949
- Joined: Fri Jun 19, 2020 9:59 am
- Has thanked: 9 times
- Been thanked: 6 times
We will assume you are already installed PHP 8.2.
Logged in as 'root', do the following:
Based on tutorial from https://learn.microsoft.com/en-us/sql/c ... -on-debian
Logged in as 'root', do the following:
Code: Select all
apt-get update
apt-get install -y php8.2-dev
apt-get install -y unixodbc-dev
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
locale-gen
update-alternatives --set php /usr/bin/php8.2
pecl install sqlsrv
pecl install pdo_sqlsrv
printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.2/mods-available/sqlsrv.ini
printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.2/mods-available/pdo_sqlsrv.ini
phpenmod -v 8.2 sqlsrv pdo_sqlsrv
systemctl restart php8.2-fpm
when i use pecl install sqlsrv i get the following error:
I am using the latest version of myvesta and I have php 8.2 installed.
I've tried removing the rules from disable_functions and I still get the same error.
Code: Select all
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-upd ate pecl.php.net" to update
downloading sqlsrv-5.11.0.tgz ...
Starting to download sqlsrv-5.11.0.tgz (192,671 bytes)
.........................................done: 192,671 bytes
34 source files, building
running: phpize
sh: 1: phpize: not found
ERROR: `phpize' failed
Code: Select all
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/php8.2 82 auto mode
1 /usr/bin/php5.6 56 manual mode
2 /usr/bin/php7.2 72 manual mode
3 /usr/bin/php7.4 74 manual mode
4 /usr/bin/php8.1 81 manual mode
5 /usr/bin/php8.2 82 manual mode
After executing that command I had this error:
plat.h:30:10: fatal error: sql.h: No such file or directory
I corrected it with this:
Code: Select all
sudo apt-get install unixodbc-dev
I can see the content of a php file with mssql in the browser but I don't know why the database doesn't connect with remote ip.
I have tested it from Microsoft SQL Server Manager Studio, and I connect it to the database, it works, but it doesn't work from Vesta. I think something is missing in the web server.
Could you see what is missing to connect to a remote database please?
I have tested it from Microsoft SQL Server Manager Studio, and I connect it to the database, it works, but it doesn't work from Vesta. I think something is missing in the web server.
Could you see what is missing to connect to a remote database please?