Firebird client for Windows, How to compile
Firebird is a relational database offering many ANSI SQL standard features that runs on Linux, Windows, and a variety of Unix platforms. For more information, please see: Firebird homepage and the about Firebird page.
Available libraries
Client library need to be built against the Firebird's engine version running in the destination environment. The best official stable release is Firebird 3.0.x 32-bit and 64-bit for Windows. Beware that your web application server may be running a different OS from database server. That means that you can have a web server trying to connect a firebird database server running on Linux or other Unixes. If this is the case you must deploy anyway the correct firebird's client library and install in system directory.
Hint on selecting file to install from sourceforge's repository
In the complete file list there are a lot of file, for many different scopes. Don't select this types of files:
- with extension .zip
- containing the string “pdb” in the name
- containing the string “embed” in the name
The files to download are then in the form Firebird-x.y.z.t-so.exe where
- x is the major version number
- y is the minor version number
- z is the release level
- t is the build number
- so is the operative system type (win32 or x64)
If your firebird database server is installed in another machine than web server running PHP, you must select the same version of your database server (x, y and the most recent z), but the so of your web server.
Firebird engine allready installed
You must detect which version is running: you may need an administrator tool, or in %ProgramFiles%\Firebird\Firebird_x_y\bin try in a terminal session the command
isql -z
.
See also here.
If the database server is installed in the same machine of development, needed libraries and include files are allready installed in proper directories.
If the database server is installed in another machine, then you need to install development files and firebird's client libraries from sourceforge repository.
Firebird engine not yet installed, or development only environment
Packages are downloadable from sourceforge's repository. Select
* firebird-win32 for 32-bit windows ( here direct link )
* firebird-win64 for 64-bit windows ( here direct link )
Each windows package, if desired, can install only client and development files: you are requested to check desired options during .exe installation. So, for development purposes only, don't check to install server engine option: each major version installs in a different subdir in the %ProgramFiles%\Firebird\ directory, so you can select which version build changing selected dir in %lib% and %include% user environment variables.
Building php_interbase.dll
(TbD)
Common requirements
In order to compile php_interbase.dll shared library against any Firebird_x_y version, you need to have this files
- installed in %ProgramFiles%\Firebird\Firebird_x_y\include
- ibase.h
- iberror.h
- ib_util.h
- installed in %ProgramFiles%\Firebird\Firebird_x_y\lib
- fbclient_ms.lib
- ib_util_ms.lib
- installed in system directory
- fbclient.dll
If any of the files in lib or include subdirs is missing, you may have not checked for installing the development support files. If fbclient.dll is missing you can create it with these steps (sobstitute x and y with your version's numbers and note space between i and f in instclient command):
- open a terminal window
CD \%ProgramFiles%\Firebird\Firebird_x_y\bin
instclient i f
Building php_interbase.dll/pdo_firebird.dll with Visual Studio 20xx
I have wrote the steps in compiling php_interbase.dll with using the Firebird 2.5.x binaries here but if you want to debug the Firebird client dll or the engine you should follow the steps bellow (requires Firebird 2.5.x compilation also php 5.x.x compilation using the same runtime to be possible a correct debug environment)
- Install the Visual Studio 20xx and the required Windows SDK described in these steps Windows Build, step by step and build your own php
- Download Firebird 2.5.x Final source code Firebird-2.5.5.26952-0.tar.bz2 . Open it and extract it with 7zip somewhere in C:\Firebird2.5_src
Read how to build Firebird with Visual Studio 20xx https://github.com/FirebirdSQL/firebird/blob/master/doc/README.build.msvc.html
- Download Sed setup from GnuWin32 project I had to run the setup and i extract into c:\gnuwin32
- Add sed c:\gnuwin32\bin to the PATH environment variable , test it from a new console if it works by typing sed it should show you something abut gnu sed help
- From cmd in builds\src dir and run in order: make_icu , make_boot , make_all
- If all is ok under output_Win32 you should have the bin folder include and lib , thouse you need to copy them in the php build directory and next you should enable firebird when building it with configure like configure --disable-all --with-interbase --with-pdo-firebird -with-cli
- run nmake and all should compile it and the output of compiler should be in Release_TS (if you get an error about consts_pub.h not found then you might now that you need to comment the line with #include “consts_pub.h” becuase that is a Non-production version of ibase.h Using raw, unprocessed concatenation of header filesand consts_pub.h is already concatenated to the ibase.h file)
- Check it with php -m and see if interbase extension is enabled (if you get that fbclient.dll is not found then you need to add firebird\bin folder to the PATH or to do a super server install and that it will install the dll for you)