How to install PDO_DBLIB module in Cpanel server
The PDO_DBLIB module requires two other php modules.
PDO >> Can be enabled using easyapache
freetds >> Steps for enabling this module is given below
Step1: Download FreeTDS
#wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
Step2: Extract the downloaded file
#tar zfvx freetds-stable.tgz
Step3: Install it using the below commands
#cd freetds-*;
#./configure –prefix=/usr/local/freetds –with-tdsver=8.0 –enable-msdblib –enable-dbmfix –with-gnu-ld; make ; make install
Step4: 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
*If you are using other Builds of Apache or PHP you may refer to the following for the correct file to edit instead of /var/cpanel/easy/apache/rawopts/all_php5 such as the case here.
* Apache 1.3.x – /var/cpanel/easy/apache/rawopts/Apache1
* Apache 2.0.x – /var/cpanel/easy/apache/rawopts/Apache2
* Apache 2.2.x – /var/cpanel/easy/apache/rawopts/Apache2_2
* All PHP 4.x versions – /var/cpanel/easy/apache/rawopts/all_php4
* All PHP 5.x versions – /var/cpanel/easy/apache/rawopts/all_php5
* Mod_suPHP – /var/cpanel/easy/apache/rawopts/all_suphp
* Specific PHP Version – /var/cpanel/easy/apache/rawopts/PHP-X.X.X
Step5: 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.hp
Step6: Now run Easy Apache and make sure that Mysql, Mysql of the system, amd Mysqli are all selected.
Step7: Simply build.
#/scripts/easyapache
Note:
If running a 64bit OS and get an error about
configure: error: Could not find /usr/local/freetds/lib64/libsybdb.a|so
you’ll need to link a directory.
In this example it was an easy fix.
#cd /usr/local/freetds/
#ln -s /usr/local/freetds/lib lib64
#ll /usr/local/freetds/lib64/libsybdb.a
#ll /usr/local/freetds/lib64/libsybdb.so
#/scripts/easyapache
Steps to enable PDO_DBLIB module
If you are using PHP 5.2 or earlier then you can go to the PECL module installer and search for PDO (don't just have it list all modules, they won't all show up).
That will give you a list of PECL PDO modules, including PDO_DBLIB to install.
In that case run the command,
#pecl install PDO_DBLIB
Other wise you will get the error
pear/PDO_DBLIB requires PHP extension 'pdo' version >=1.0
If so, we need to install PDO_DBLIB manually. Please follow the below steps for manual installation.
#pecl download pdo_dblib
This will download a tar ball of the extension. Extract the tar ball.
#tar -xzvf PDO_DBLIB-*.tgz
That will uncompress the package in to a standalone file, package.xml and a folder containing the extension, in my case it was, PDO_DBLIB-X.X. Where X was the version number. # Open package.xml using your favourite command line editor. Find and remove the line,
<dep type=”ext” rel=”ge” version=”1.0″>pdo</dep>
Save the package.xml file, and move it in to the PDO_DBLIB directory.
#mv package.xml ./PDO_DBLIB-X.X
Navigate to the PDO_DBLIB directory, then install the package from the directory. You may need root access for this step.
#cd ./PDO_DBLIB-XX
#./configure --with-pdo-dblib=/usr/local/freetds
#make
#make install
Then 'pdo_dblib.so' will be installed in the location /usr/local/lib/php/extensions/no-debug-non-zts-20090626/
Open php.ini file and add the line following line
extension=pdo_dblib.so
Restart apache
#/etc/init.d/httpd restart
Check the php info page to ensure the module