How to ODBC support on a cPanel server

How to ODBC support on a cPanel server

You first have to install the devel packages for unixodbc, then add a line in rawopts file and rebuild Apache+PHP.

1. Install the UnixODBC devel packages:

yum install unixODBC unixODBC-devel

2. You now need to create a file “all_php7″ to add a line to enable odbc so that apache build will pick it up from there. File all_php5 is for PHP7 and all_php8 is for PHP8.

nano /var/cpanel/easy/apache/rawopts/all_php7

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
whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.