php_cubrid_linux_build_guide


Configuring the Environment

  • cubrid 2008 R3.1:
    Install CUBRID 2008 R3.1, and make sure the Environment Variable %CUBRID% is defined in your system;
  • PHP 5.3/5.2 source code:
    Download PHP source code (PHP 5.2 or 5.3) from PHP.net. When we write this build guide, the latest stable version of PHP 5.3 is 5.3.3, and PHP 5.2 is 5.2.14.
  • Apache2:
    We can use apache2 to test PHP;

Compile PHP Library with PHP source code

1. Extract PHP source code, and create directory cubrid under dir ext:

$> tar zxvf php-<version>.tar.gz (or tar jxvf php-<version>.tar.bz2)
$> cd php-<version>/ext
ext> mkdir cubrid

2. Put the following files in PHP Library into directory cubrid:

cubrid-php> php_cubrid.c php_cubrid.h php_cubrid_version.h config.m4

3. Go to the root directory of PHP source code and update the configuration file:

php-root> ./buildconf --force

Note: When developing a PHP extension, it is strongly recommended that autoconf version 2.13 be installed, despite the newer releases which are available. Version 2.13 is recognized as a common denominator of autoconf availability, usability, and user base. Using later versions will sometimes produce cosmetic differences from the expected output of configure.

You can set environment PHP_AUTOCONF to path of autconf-2.13 and set PHP_AUTOHEADER to path of autoheader-2.13.

4. Configure the project. Before you run configure, we strongly recommend that you run "./configure –h" to check the configure options.
An example may be like this (we assume that apache2 has been installed in /usr/local):

php-root>./configure --prefix=/usr/local/php -with-cubrid=shared --enable-maintainer-zts --with-apxs2=/usr/local/apache2/bin/apxs

--with-cubrid=shared

Include CUBRID support 

--enable-maintainer-zts

Enable thread safety - for code maintainers only 

--with-apxs2=FILE 

Build shared Apache 2.0 Handler module.
File is the optional pathname to the Apache apxs tool apxs

5. Build and install the package. If it was successfully compiled, the cubrid.so file will be created in the /modules directory:

php-root> make; make install

6. Copy php.ini-xxx (In PHP 5.2.x, they are php.ini-dist and php.ini-recommended; In PHP 5.3.x, they are php.ini-development and php.ini-production; choose what you need) file to directory /usr/local/php/lib, and rename it to php.ini.

php-root> cp php.ini- production /usr/local/php/lib/php.ini

7. In php.ini file set the extension_dir variable and add CUBRID PHP Library to extension variable. For example:

extension_dir = "/usr/local/php/lib/php/extension/no-debug-zts-xxx"
extension = cubrid.so

Test CUBRID PHP Library Installation

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

<?php phpinfo(); ?>

2. Use web browser to visit http://localhost/test.php, and if you see the following contents, the installation is successful.

CBURID

Value

Version

8.3.1.XXXX

Page info
viewed 235 times
translations en
Author
posted 9 months ago by
hellohuizhang
Contributors
updated 9 months ago by
View revisions
Share this article