There are many how-to’s and examples on the net on how to enable MSSQL support in PHP on a Cpanel box, but none are 100% correct nor easy to maintain. I needed a solution that would be simple to maintain — in other words, something that didn’t have to be done over and over each time PHP was upgraded.
cd /usr/src wget http://www.unixodbc.org/unixODBC-2.3.0.tar.gz tar -zxf unixODBC-2.3.0.tar.gz cd unixODBC-2.3.0 ./configure -prefix=/usr/local -enable-gui=no make install
cd /usr/src/ wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz tar -zxf freetds-stable.tgz cd freetds-* ./configure -with-tdsver=8.0 -with-unixODBC=/usr/local make install ldconfig
Tell EasyApache we want MSSQL support:
echo '--with-mssql' >> /var/cpanel/easy/apache/rawopts/all_php5
Now, recompile PHP/Apache through EasyApache. It’s OK to use the same options as previous, because MSSQL isn’t an option in EasyApache that can be toggled on and off; we did it manually (and permanently) in the last step.
Verify your work by checking phpinfo() for the mssql section.