简体   繁体   中英

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

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

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

How to on Ubuntu (15.04):

1) install php5-dev

sudo apt-get install php5-dev

2) install dbase via pecl

sudo pecl install dbase

3) load extension

3.1) create dbase.ini file in /etc/php5/mods-available/ directory with this content:

extension=dbase.so

3.2) create sym link in /etc/php5/apache2/conf.d/ directory:

sudo ln -s ../../mods-available/dbase.ini 20-dbase.ini

4) restart apache

Check is there dbase extension(php_dbase.dll) is there in 'C:\\xampp\\php\\ext'. if dll file there then check is it enabled or not in php.ini file. if not enabled follow from step 3.

if it's not there then follow below steps.

  1. download (refer below link) php_dbase.dll file according to your system and php version.

    Link - https://pecl.php.net/package/dbase

  2. add downloaded 'php_dbase.dll' file to in 'C:\\xampp\\php\\ext'

  3. open php.ini file

  4. search 'extension=', you will find many extension there.

  5. add below line after all extension list. 'extension=php_dbase.dll' (without quote)(no issue if add this line at the end of file.

Restart apache server. it will start working in local - windows system.

Note:- update file name with 'php_dbase.dll' if file name is different.

You need to check in PHP directory is file php_gmp.dll enable and if it does, then in php.ini add this string "extension=php_gmp.dll" in extensions section.

If file does not exist then add it to php in apache - http://www.dll4free.com/php_gmp.dll.html

May be Open server will be better them XAMPP - http://translate.google.ru/translate?sl=ru&tl=en&js=n&prev=_t&hl=ru&ie=UTF-8&u=http%3A%2F%2Fopen-server.ru%2Fdownload.html&act=url It have many PHP versions, mySQL, PostgresQL, MongoDB, memcache, administration tools, regular updates, english support in forum and free!

check in your xampp/php/ext folder for php_gmp.dll ,if the extension is there add this extension=php_gmp.dll to php.ini file in xampp/php/php.ini . else add this dll to xampp/php/ext and do the above step restart your apache server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM