The following section describes how to install the dblib extension in php and connect to mssql. I think this is quite good. now I will share it with you and give you a reference. Let's take a look at the following small series for you to install dblib extensions in php and connect to mssql. I think this is quite good. now I will share it with you and give you a reference. Let's take a look at it with Xiaobian.
1. install freetds and then modify the configuration file.
If version 0.82 is not installed, compilation failure will be reported.
Compile Failure With freetds0.82
Go to the freetds directory to compile and install
./configure --prefix=/usr/local/freetds --enable-msdblib --enable-sybase-compat --disable-threadsafemakemake install
2. install mssql again
Go to the directory to compile and install
/usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-mssql=/usr/local/freetdsmakemake install
3. reinstall dblib
Go to the directory to compile and install
/usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-dblib=/usr/local/freetdsmakemake install
4. modify php. ini
extension=mssql.soextension=pdo_dblib.so
Tsql client connection command
/usr/local/freetds/bin/tsql -H 192.168.1.100 -p 1433 -U sa -P 123456 -D user
Modify configuration file
/Usr/local/freetds/etc/freetds. conf configuration file location tds version = 8.0 // modify client charset = UTF8 // add
If the database cannot be connected, check the version and set the global option in/usr/local/freetds/etc/freetds. conf to "tds version = 8.0 ".
If the result is garbled, change/usr/local/freetds/etc/freetds. conf to add a client charset = UTF8 to global.
Adaptive Server is unavailable or does not exist "error connecting to SQL Server from PHP is caused by no port
Add a port or you cannot connect to it.
'Dblib: host = 192.168.8.888: 1433; dbname = xxxx'
The above section describes how to install the dblib extension in php and connect to mssql. For more information, see The PHP Chinese website (www.php1.cn )!