Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Build CUBRID PHP Driver on Mac OS X using CCI Driver


In this tutorial you will learn how to install CUBRID PHP driver on Mac OS X using CUBRID CCI driver.

Download CCI driver

CUBRID PHP driver has a dynamic dependency on CCI driver. We have built a custom CCI driver for Mac users. You can download either 64 or 32 bit version. Once you download it, you need to copy the contents of the /lib directory /usr/lib and the contents of /include directory into /usr/include. The following example illustrates how to extract a 64-bit version.

tar zxvf CUBRID-CCI-8.4.1.4009-x64.macosx.tar.gz
sudo cp CUBRID-CCI-8.4.1.4009-x64/lib/* /usr/lib
sudo cp CUBRID-CCI-8.4.1.4009-x64/include/* /usr/include

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.

cd CUBRID-8.4.1.0003
phpize

Next, configure the build.

  1. Notice the --with-php-config option. Make sure you use the correct one.
    1. In our case we have installed PHP using Macports which usually installs packages to /opt/local/ directory. So we used the php-config distributed by Macports.
    2. However, if you use the default PHP engine distributed by Apple, the php-config file may be located in /usr/bin/php-config.
    3. Or if you use XAMPP, the php-config file can be in XAMPP/xamppfiles/bin/php-config.
  2. The --with-cubrid option. This is that same directory where we have extracted CUBRID CCI driver files.

./configure --with-cubrid=/usr --with-php-config=/opt/local/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 you PHP extensions directory. If you do not know where you PHP extensions directory is located, you can execute that same php-config file which will tell you the exact location of you PHP extensions. In our case, it is in /opt/local/lib/php/extensions/no-debug-non-zts-20090626 directory.

sudo cp modules/cubrid.so /opt/local/lib/php/extensions/no-debug-non-zts-20090626/

Now find the php.ini file and add the following line which instructs your Web server or FastCGI Process Manager to load CUBRID extension with the next restart.

extension=cubrid.so

Done! Now restart your Web server to load CUBRID extension.

Test CUBRID PHP API

Create a simple test.php file with the following contents:

<?php phpinfo(); ?>

In your browser visit http://localhost/test.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 3099 times
translations en
Author
posted 2 years ago by
CUBRID
Contributors
updated 2 years ago by
View revisions
Share this article