Page 1 of 1
How to install and configure the connection to mssql in php8.2?
Posted: Mon Jun 12, 2023 5:01 pm
by kziel
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?
Re: how to install and configure the connection to mysql in php8.2?
Posted: Mon Jun 12, 2023 9:12 pm
by myVesta
mysql or mssql?
in subject you wrote 'mysql'
Re: how to install and configure the connection to mysql in php8.2?
Posted: Sat Jun 24, 2023 12:15 pm
by kziel
myVesta wrote: ↑Mon Jun 12, 2023 9:12 pm
mysql or mssql?
in subject you wrote 'mysql'
I'm sorry I wrote mysql in the title, what I need is to connect to mssql.
Re: how to install and configure the connection to mssql in php8.2?
Posted: Sat Jun 24, 2023 1:21 pm
by myVesta
We will assume you are already installed PHP 8.2.
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
Based on tutorial from
https://learn.microsoft.com/en-us/sql/c ... -on-debian
Re: how to install and configure the connection to mssql in php8.2?
Posted: Tue Jun 27, 2023 12:13 pm
by kziel
when i use pecl install sqlsrv i get the following 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
I am using the latest version of myvesta and I have php 8.2 installed.
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
I've tried removing the rules from disable_functions and I still get the same error.
Re: How to install and configure the connection to mssql in php8.2?
Posted: Tue Jun 27, 2023 1:44 pm
by myVesta
try:
Code: Select all
apt update
apt install -y php8.2-dev
Re: How to install and configure the connection to mssql in php8.2?
Posted: Tue Jun 27, 2023 5:21 pm
by kziel
myVesta wrote: ↑Tue Jun 27, 2023 1:44 pm
try:
Code: Select all
apt update
apt install -y php8.2-dev
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:
Thank you very much for the help.
Re: How to install and configure the connection to mssql in php8.2?
Posted: Tue Jun 27, 2023 7:23 pm
by myVesta
Thanks for the feedback, I added it to the manual.
Re: How to install and configure the connection to mssql in php8.2?
Posted: Wed Jun 28, 2023 8:36 am
by kziel
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?
Re: How to install and configure the connection to mssql in php8.2?
Posted: Wed Jun 28, 2023 9:56 am
by myVesta
I don't have any idea how I can see it.
Do you have something in the error log of your domain?