1

I am trying to connect to a Firebird database using PHP. This is the simple code that I use to connect to it.

$user = "******";
$password = "******";
$ODBCConnection = odbc_connect("DRIVER={Firebird/InterBase(r) driver};Database=******;Server=******;Port=******", $user, $password);

I have installed the ODBC driver for Firebird from this webpage https://www.firebirdsql.org/en/odbc-driver/. I've managed to add the correct (I believe) string to the DRIVER inside the ODBC Conection, but now I encounter this error:

Warning: odbc_connect(): SQL error: [ODBC Firebird Driver]Unable to connect to data source: library 'gds32.dll' failed to load, SQL state 08004 in SQLConnect

I am running an Apache server using XAMPP on localhost. Everything I wrote is in the index.php file, just trying to connect to the database.

Any help would be greatly appreciated.

jarlh
  • 42,561
  • 8
  • 45
  • 63
Sebastian
  • 87
  • 2
  • 11
  • Why don't you use the Firebird PHP driver? In any case, the error means that you have configured your datasource to use gds32.dll (instead of fbclient.dll), and that file doesn't exist on your system. Did you install the Firebird client library? – Mark Rotteveel Dec 08 '20 at 13:36
  • Do you happen to know the name of the PHP Firebird driver? I can try and use that and see if that works. I installed this version of Firebird https://sourceforge.net/projects/firebird/ – Sebastian Dec 08 '20 at 13:42
  • That is the old project location (the last files there are from 2017). Download files from https://www.firebirdsql.org/. You can find the PHP driver at https://firebirdsql.org/en/php-driver/ (or https://github.com/FirebirdSQL/php-firebird). You will still need to install a Firebird client library (eg using the Firebird 3 installer), as you will need to do for the ODBC driver. – Mark Rotteveel Dec 08 '20 at 13:54

1 Answers1

3

This error occurs when you do not have the Firebird client library (fbclient.dll, or gds32.dll which is tried as a fallback) installed on your system (or you have it installed, but it has the wrong bitness).

To install the Firebird client library, use a Firebird server installer of the right bitness* (eg Firebird 3 Windows 64-bit from https://www.firebirdsql.org/en/firebird-3-0/), and install the Client components.

That said, if you're using PHP, it might make sense to use the Firebird PHP driver instead (though this will still need fbclient.dll to be installed).


*: right bitness: If you use a 32-bit PHP, you need the 32-bit client library, if 64-bit, then the 64-bit client library.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • Ok. I did install the PHP driver for now, included it in the extensions and added it to the php.ini file. I've also downloaded the firebird client. What would the string for the Driver be to use the one that has been added to PHP? I can't seem to find it in the ODBC drivers list. – Sebastian Dec 08 '20 at 15:36
  • Using the PHP driver means that you don't need to use ODBC, you would use the Firebird PHP driver. – Mark Rotteveel Dec 08 '20 at 15:46