0

We move one of our sites to a new server with Centos 7. We make the settings, the PHP 7 is working but we can't run libraries for MSSQL connection. For now we do this:

yum install freetds 
yum install php-mssql

FreeTDS appear that was installed, but: not working, in phpinfo() does not appear and in Easyapache 4 > PHP Extensions does not appear.

Thanks!

Adrian S.
  • 129
  • 1
  • 2
  • 12
  • Is there are reason you're using FreeTDS? Microsoft provides Linux drivers for PHP specifically. See: http://stackoverflow.com/questions/34377338/linux-php-7-0-and-mssql-microsoft-sql – FlipperPA Mar 10 '17 at 00:37
  • Yes, I know. Thanks anyway :)! We have to modify too many sites :( Anyway, for now, we go with PHP 5.6 - this works fine. – Adrian S. Mar 11 '17 at 08:16

1 Answers1

0

1) Download FreeTDS

wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

2) Extract

tar zfvx freetds-stable.tgz

3) Configure $ Make

cd freetds-*; ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld; make ; make install

4) Add the compile flag for freetds to /var/cpanel/easy/apache/rawopts/all_php5 In this version, PHP 5 is the focus hence that specific file. Add the following:

echo "--with-mssql=/usr/local/freetds" >> /var/cpanel/easy/apache/rawopts/all_php5

5) Touch the following files as these are what are checked for by PHP. The following error will result if they are not in place. configure: error: Directory /usr/local/freetds is not a FreeTDS installation directory. Here are the files to create for PHP's conditional check:

touch /usr/local/freetds/lib/libtds.a
touch /usr/local/freetds/include/tds.h

6) Now run Easy Apache and make sure that Mysql, Mysql of the system, amd Mysqli are all selected.

7) Simply build.

/scripts/easyapache

I found this - all above - here:

https://forums.cpanel.net/threads/definitive-freetds-installation-instructions.88561/

http://pointbeing.net/weblog/2010/05/successful-microsoft-sql-server-support-for-php-on-linux.html

Adrian S.
  • 129
  • 1
  • 2
  • 12
  • Don't work :( PHP 7 removed the extensions needed to connect to MSSQL. I must set the old version of PHP on Centos7. – Adrian S. Mar 08 '17 at 09:26