In this tutorial you will learn how to install CUBRID PHP driver using CUBRID CCI driver to be able to use it with XAMPP for Mac OS X. This tutorial is very similar to the original Build CUBRID PHP Driver on Mac OS X using CCI Driver except for that configuration step which is different for XAMPP since XAMPP binaries are universal (x86_64 compatible). For XAMPP we need to build x86 compatible PHP extension.
CUBRID PHP driver has a dynamic dependency on CCI driver. We have built a custom CCI driver for Mac users. for XAMPP usage download 32 bit version. Once you download it, extract it to /usr/local/cubrid directory. The following example illustrates how to extract the 32-bit version.
tar zxvf CUBRID-CCI-188.8.131.5209-x86.macosx.tar.gz sudo mv CUBRID-CCI-184.108.40.20609-x86 /usr/local/cubrid
Once you have moved the files, make sure the CCI library is executable by everyone.
sudo chmod +x /usr/local/cubrid/lib/libcascci.8.dylib
First, download the source code of the latest version of CUBRID PHP API from PECL repository. Then extract it. Below is the example which illustrates how to extract the source code of PHP API version 8.4.1.003.
tar zxvf CUBRID-8.4.1.0003.tgz
Now, run phpize inside CUBRID-8.4.1.0003 source code directory to prepare CUBRID PHP API extension for compilation. For XAMPP, we will use the phpize distributed with its binaries.
cd CUBRID-8.4.1.0003 /Applications/XAMPP/xamppfiles/bin/phpize
Next, configure the build.
CFLAGS="-arch i386" CCFLAGS="-arch i386" CXXFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure --with-cubrid=/usr/local/cubrid/ --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
Finally, make it happen. If it was successfully compiled, the cubrid.so file will be created under the ./modules directory:
Copy the compiled cubrid.so extension to XAMPP PHP extensions directory. In XAMPP version 1.7.3 for Mac, the extensions directory is located in /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/.
sudo cp modules/cubrid.so /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/
Now open the php.ini file located in /Applications/XAMPP/xamppfiles/etc/php.ini and add the following line which instructs XAMPP to load CUBRID extension with the next restart.
Done! Now restart XAMPP Apache server to load CUBRID extension.
In your browser visit http://localhost/xampp/phpinfo.php. Search for "CUBRID". You should see entries like Version, CCI Version, and CUBRID Version.