How to solve "Call to undefined function dbase_open() " error in windows

chaitra picture chaitra · Mar 12, 2014 · Viewed 23.2k times · Source

Hi i want to load DBF file to mysql, am using xampp,php version 5.5.6

i had write the below code,

But am getting Error ---

Fatal error: Call to undefined function dbase_open() in C:\xampp\htdocs\imports\import_geo.php on line 47

$dbf = dbase_open('OUTLETS/regions.dbf', 0);
$num_records = dbase_numrecords($dbf);
for($i=1;$i<=$num_records;$i++)
{
    $record = dbase_get_record_with_names($dbf, $i);
    $stmt_bricks->execute(array(
        ':id' => $next_brick_id,
        ':type' => 'Region',
        ':code' => $record['REG_CODE'],
        ':descr' => $record['REG_DESC'],
    ));
    $regions_code_to_id[$record['REG_CODE']] = $next_brick_id++;
}

I saw in one article, we have to uncomment extension=php_gmp.dll in php.ini, but in my php.ini extension=php_gmp.dll is not available, please help me.

Thanks in advance

Answer

user3871119 picture user3871119 · Sep 16, 2014

dBase is moved to PECL for now

yum install php-pear
pecl install dbase

After successful execution, you'll need to add "extension=dbase.so" to your php.ini

Or create dbase.ini in /etc/php.d with

extension=dbase.so

fliber.net uses this