Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Build CUBRID PHP Driver for XAMPP on Mac OS X using CCI Driver


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.

Download CCI driver

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-8.4.1.4009-x86.macosx.tar.gz
sudo mv CUBRID-CCI-8.4.1.4009-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

Download and Compile PHP driver

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.

  1. Notice the --with-php-config option. For XAMPP, use the php-config file distributed with its binaries.
  2. The --with-cubrid option. This is that same directory where we have extracted CUBRID CCI driver files.
  3. Notice a series of environmental variables set for this configuration. They are important for PHP API compilation for XAMPP. -arch i386 allows the build to be configured for x86 architecture. You need to copy  and paste all of the following commands in one line.

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:

make

Configure php.ini

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.

extension=cubrid.so

Done! Now restart XAMPP Apache server to load CUBRID extension.

Test CUBRID PHP API

In your browser visit http://localhost/xampp/phpinfo.php. Search for "CUBRID". You should see entries like Version, CCI Version, and CUBRID Version.

If you have any questions, please ask them at our Q&A site. If any issues with installation, post on our forum.

comments powered by Disqus
Page info
viewed 2205 times
translations en
Author
posted 2 years ago by
CUBRID
Contributors
updated 2 years ago by
View revisions
Share this article