How to use Firebird with PHP?


Here's a short HOWTO for PHP4 and PHP5. If you run Debian or Ubuntu and PHP5, read FAQ #234.

The simplest way of adding Firebird support is adding the interbase module to an existing PHP installation. On Windows it's a matter of simply unpacking the .zip package and extracting the PHP_INTERBASE.DLL extension, or choosing the Interbase package while installing from setup.exe installer. Please note that in the latter case, the installer also installs old gds32.dll from InterBase 6.0, which you need to delete manually and replace with Firebird's fbclient.dll (just rename it to gds32.dll). On Linux, you need to compile the interbase.so module. It is done like this:

1. install php-devel package (needed for phpize. If you already have phpize command, you don't need it)
2. get the php source code for the exact version as you are running
3. unpack the source and go to ext/interbase directory
4. run: phpize
5. run: ./configure --with-interbase=shared,/opt/firebird
6. run: make
7. this will create interbase.so module (most probably in .libs subdirectory)

The following steps apply for Windows as well:

8. copy the module (.so or .dll) to /usr/lib/php/extensions (or whatever is the 'extension_dir' setting in php.ini)
9. uncomment the ;extension=php_interbase.dll in php.ini
10. restart Apache if you are using PHP with it

Here's a set of tests to see if you extension is working properly:
http://fbexport.sourceforge.net/ibtest.php.txt

Please note that PHP5.x has a bug regarding NUMERIC(18,7) and other datatypes with precision higher than 6. The bug has been reported to PHP bug tracker, but is not fixed yet (PHP 5.2.3).

Furl  del.icio.us  co.mments  digg  YahooMyWeb 

Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.

If you are a commercial tool maker and your tool features a great way to handle the issue written about in this FAQ, please check out our advertisement page.



All contents are copyright © 2007-2008 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Tool reviews  
Add content   Advertise   About  
 

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous