Adding the DBF dBase (or Any Custom) Extension in Linux (Red Hat, CentOS, or Fedora)

Posted by: david on 11/29/2014 - 02:58 PM
The previous article explained how to convert and import data from DBF files into MySQL. It is actually simple enough to enable the dBase extension for PHP for Windows by just by uncommenting out a line in php.ini, but if you are using Red Hat/CenOS/Fedora, this is not as simple.


There is no RPM file that you can simply install to enable the dBase extension, so you have to recompile and build the PHP Linux RPM. Here are the steps to do this (note that this can work with other extensions that you can't find the rpm for):



  1. download the source rpm for PHP, usually it'll have the word "src" in the file name

  2. install it - e.g. "rpm -Uvh php_src.rpm"

  3. edit the php.spec file, usually located at /usr/src/redhat/SPECS/php.spec, and add "--enable-dbase"




  • run rpmbuild - e.g.: "rpmbuild -ba php.spec"

  • Go to the directory of the newly created RPMs (e.g. /usr/src/redhat/RPMS/i386/) and install them (note the --force):


    rpm -Uvh --force php-4.3.8-1.1.i386.rpm php-devel-4.3.8-1.1.i386.rpm php-imap-4.3.8-1.1.i386.rpm php-ldap-4.3.8-1.1.i386.rpm php-mysql-4.3.8-1.1.i386.rpm php-pgsql-4.3.8-1.1.i386.rpm php-odbc-4.3.8-1.1.i386.rpm php-snmp-4.3.8-1.1.i386.rpm php-domxml-4.3.8-1.1.i386.rpm php-xmlrpc-4.3.8-1.1.i386.rpm php-mbstring-4.3.8-1.1.i386.rpm php-debuginfo-4.3.8-1.1.i386.rpm



  • That should get the job done. Even though this example uses the older PHP 4, you can easily substitute in the appropriate new PHP 5.x versions.