Short tutorial on how to compile Firebird extension for PHP under MAC OS.
- Autoconf, you can install it via Homebrew (brew install autoconf)
- Because we needs Firebird libs. for compiling interbase, we have to download Firebird Server Package (http://www.firebirdsql.org/en/downloads), download the LIPO package (important!)
Interbase extension is currently not shipped with PHP source code. But below you will find way to achieve it.
@MartinKoeditz is working on driver for PHP>=7.1. The repo is here: https://github.com/FirebirdSQL/php-firebird. We cannot download final driver, one needs to compile it, here is how.
- git clone https://github.com/FirebirdSQL/php-firebird.git
- cd php-firebard
- /Applications/MAMP/bin/php/php7.4.2/bin/phpize
- CPPFLAGS="-I/usr/local/lib/Firebird.framework/Headers" ./configure
- make
- make install
- Open MAMP pro PHP 7.4.2 config file (.ini extension) and append new line: extension=interbase.so
- Restart MAMP server
The tutorial is still working, keep in mind that this tutorial is for Firebird 2.5.x only!
- Check which PHP version your MAMP server use, for example version 4.1.1 use PHP 7.1.1
- Download PHP source code from https://secure.php.net/downloads.php
- Unzip downloaded sources, rename it to "php" and move it to your MAMP include folder /Applications/MAMP/bin/php/php7.1.1/
- Enter to interbase extension folder cd /Applications/MAMP/bin/php/php7.1.1/include/php/ext/interbase/
- Run phpize with command /Applications/MAMP/bin/php/php7.1.1/bin/phpize
- Run configure ./configure --with-php-config=/Applications/MAMP/bin/php/php7.1.1/bin/php-config
- Create symbolic link to Firebird ibase.h and iberror.h in our include/php folder so ln -s /Library/Frameworks/Firebird.framework/Headers/*.h /Applications/MAMP/bin/php/php7.1.1/include/ ln -s /Library/Frameworks/Firebird.framework/Headers/*.h /Applications/MAMP/bin/php/php7.1.1/include/php/ext/interbase/include/ these two header files are required
- Run make (for someone maybe make -j8)
- Run make install
You should get your interbase.so (/Applications/MAMP/bin/php/php7.1.1/include/php/ext/interbase/modules/interbase.so) ! Wooah
- Check which PHP version your MAMP server use, for example version 3.4.0 use PHP 5.6.10 by default
- Download PHP source code from https://secure.php.net/downloads.php
- Unzip downloaded sources, rename it to "php" and move it to your MAMP include folder /Applications/MAMP/bin/php/php5.6.10/
- Enter to interbase extension folder cd /Applications/MAMP/bin/php/php5.6.10/include/php/ext/interbase/
- Run phpize /Applications/MAMP/bin/php/php5.6.10/bin/phpize
- Run configure ./configure
- Create symbolic link to Firebird ibase.h and iberror.h in our include/php folder so ln -s /Library/Frameworks/Firebird.framework/Headers/*.h /Applications/MAMP/bin/php/php5.6.10/include/ these two header files are required
- Run make
- Run sudo make install
You should get your interbase.so ! Wooah
Be sure that you are not running PHP in CGI mode (you will propably get 500 error code during connection to database) !