ODBC support on a cPanel server

How to compile unix odbc on a cPanel server? On a cPanel server, the /scripts/easyapache script almost provides all the modules that are required to host the websites but the modules such as odbc has to be installed manually. You first have to install the devel packages for unixodbc, then add a line in rawopts file and rebuild Apache+PHP. That is it.

1. Install the UnixODBC devel packages:

yum install unixODBC unixODBC-devel

2. You now need to create a file “all_php5” to add a line to enable odbc so that apache build will pick it up from there. File all_php5 is for PHP5 and all_php4 is for PHP4.

pico /var/cpanel/easy/apache/rawopts/all_php5

3. Add the following line:

--with-unixODBC=/usr

4. Rebuild Apache/PHP using the “easyapache” script and the above file will be picked up automatically:

/scripts/easyapache

Once the compilation completes, you should have odbc module compiled with PHP. You can check the module either using a phpinfo() file OR through shell by executing:

php -i | grep odbc
This entry was posted on Monday, October 19th, 2009 and is filed under cPanel Management. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

6 Responses to “ODBC support on a cPanel server”

  1. jigmee

    i want to connect excel to my website but do not have the idea how to connect exel in cpanel..i can do it in stand alone pc using odbc and java but how to do it in C panel

  2. admin

    If it need Java to connect to Excel, make sure your hosting provider supports it on the server your website is ON. Also how exactly you connect to Excel?

  3. Amer

    I think you need double dashes here:
    -–with-unixODBC=/usr

  4. admin

    Hi Amer,

    There were double dashes but the format of highlighted text was different. I set “PreFormatted” format for the highlighted text and you can see the double-dash now.

    Thanks for pointing it out though. 🙂

  5. dhruv

    its not showing ODBC option in easyapache,

    will it works after that also??

  6. admin

    Right, easyapache doesn’t provide the ODBC option, which is why this method has to be used for installing it.