WebFaction
Community site: login faq

How do I configure my Static/CGI/PHP-5.4 application with Microsoft SQL Server support, so I can use PHP's mssql extension to connect and retrieve data from a remote Microsoft SQL Server database? "mssql" is absent from my phpinfo() output currently. Thanks in advance.

asked 21 Apr '15, 16:00

pixelatic
134
accept rate: 0%

edited 21 Apr '15, 16:00


For MS-SQL support, you'll need to build FreeTDS and PHP from source in your home directory, and then configure your Static/CGI/PHP-5.4 application to use your local version of PHP.

Here are the commands you can run to build FreeTDS and PHP 5.4:

mkdir -p ~/{src,tmp,local}
export TMPDIR=~/tmp
cd ~/src
wget 'ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz'
tar xf freetds-stable.tgz
cd freetds-0.91/
./configure --prefix=$HOME/local
make
make install
cd ~/src
wget http://us3.php.net/distributions/php-5.4.40.tar.bz2
tar jxf php-5.4.40.tar.bz2
cd php-5.4.40
./configure --prefix=$HOME/local --with-pdo-mysql --with-pdo-pgsql=/usr/pgsql-9.1 --enable-bcmath --enable-calendar --with-curl --with-openssl --enable-exif --enable-ftp --enable-mbstring --enable-soap --enable-zip --with-freetype-dir --with-gd --with-gettext --with-gmp --with-iconv --with-jpeg-dir --with-kerberos --with-mhash --with-mysql --with-mysqli --with-pgsql=/usr/pgsql-9.1 --with-png-dir --with-regex --with-xmlrpc --with-xsl --with-zlib-dir --with-config-file-path=$HOME/lib --without-pear --enable-sockets --enable-intl --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mssql=$HOME/local
make
make install

Once that's done, you then configure your app to use your local PHP installation instead of the system PHP installation:

cd ~/webapps/example_app
cp $HOME/local/bin/php-cgi my_php.cgi
echo "
Action php_custom /my_php.cgi
<FilesMatch .php$>
    SetHandler php_custom
</FilesMatch>
">>.htaccess

Hope that helps!

permanent link

answered 21 Apr '15, 20:22

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×3
×2

question asked: 21 Apr '15, 16:00

question was seen: 2,147 times

last updated: 21 Apr '15, 20:22

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM