Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register



  • How can I build and install PHP or PDO driver for CUBRID? If I have downloaded the binary file (.so or .dll), or only have the source code package, how can I build and install it?

PHP and PDO driver for CUBRID are both PHP extension written by C programming language, and released at PECL. So you can easily install them using PECL. They both support Linux (32-bit and 64-bit) and Windows platform. But a DLL for this PECL extension is currently unavailable, you can directly download the DLL (and also .so) file at or For detailed guidance about both PECL and binary installation, please read Instructions on

If you want to build your own binary from source codes on Linux or Windows, please read the build-guide.html in the CUBRID PHP & PDO release package.

Note: You can run php --ini to find the path of php.ini which the current PHP has loaded.

  • Does CUBRID PHP or PDO need any dependent library?

CUBRID PHP and PDO are both need the CUBRID CCI library. The CCI library is in $CUBRID/lib, and its header file is in $CUBRID/include. If you have set the environment $CUBRID, when installing CUBRID PHP or PDO using PECL, PECL will automatically validate the CCI library and its header file. If not, you must input the installation path of CUBRID manually when PECL is configuring the project.

If you install the CUBRID PHP or PDO on Linux, be sure that path "$CUBRID/lib" is added into environment variable $LD_LIBRARY_PATH. (It contains a colon-separated list of directories that the dynamic linker should search for shared objects when building a process image after exec, before searching in any other directories.)


  • Where can I find the documentation for CUBRID PHP and PDO? And Where can I find the release notes or change log for CUBRID PHP and PDO?

You can find the docs at and (CUBRID PHP Doc and CUBRID PDO Doc ). And you can find the release notes or change log at PECL (CUBRID PHP PECL and CUBRID PDO PECL), and when CUBRID PHP and PDO for new version CUBRID is released, there will be a release notes in its release package.


  • Does CUBRID PHP provide enough functions for using CUBRID? Does CUBRID PDO implement all functions in PDO?

CUBRID PHP provides all kinds of functions to help user making full use of CUBRID. In addition, many CUBRID MySQL Compatibility Functions have been added, which makes PHP application written for MySQL migrate to CUBRID easily.

CUBRID PDO implements almost all functions in PDO, except the function getColumnMeta. This function is EXPERIMENTAL. The behavior of this function, its name, and surrounding documentation may change without notice in a future release of PHP. So CUBRID PDO doesn’t implement this function. Instead, CUBRID PDO provides a new function cubrid_schema which plays the same role in CUBRID PHP.

  • Does CUBRID PHP or PDO support transaction and auto-commit?

Both CUBRID PHP and PDO support transaction. CUBRID PDO supports auto-commit, but CUBRID PHP version lower than 8.4.0 doesn't support auto-commit.

In CUBRID PDO (and CUBRID PHP 8.4.0 or higher), autocommit_mode is enable by default. You can use PDO::setAttribute() (cubrid_set_db_parameter in CUBRID PHP) to change its state. If you use PDO::beginTransaction (not need in CUBRID PHP) to begin a transaction, it will disable autocommit_mode and restore it after PDO::commit (cubrid_commit in CUBRID PHP) or PDO::rollBack (cubrid_rollback in CUBRID PHP). Note that before disabling the autocommit_mode, any pending transaction is automatically committed.

  • What isolation level does CUBRID support? Can I get and set its value in CUBRID PHP or PDO?

Transaction isolation level is the degree to which a transaction is separated from all other concurrent transactions. The higher isolation level means the lower interference from other transactions. The lower isolation level means the higher the concurrency. CUBRID supports isolation level from 1 to 6, and its default value is 3.

In CUBRID PHP 8.3.0 or higher, you can get the connection isolation level value using cubrid_get_db_parameter. And in CUBRID PHP 8.4.0 or higher, you can set its value using cubrid_set_db_parameter.

In CUBRID PDO 8.3.0 and 8.3.1, you can get the isolation level value using PDO::getAttribute(PDO::ATTR_SERVER_INFO). And in CUBRID PDO 8.4.0, you can get its value using using PDO::getAttribute(PDO::CUBRID_ATTR_ISOLATION_LEVEL), and set its value using using PDO::setAttribute. For example, PDO::setAttribute(PDO::CUBRID_ATTR_ISOLATION_LEVEL, PDO::TRAN_COMMIT_CLASS_UNCOMMIT_INSTANCE).

  • Does CUBRID support prepared statement? Should every sql statement be prepared?

CUBRID supports prepared statement. You can use it in both CUBRID PHP and CUBRID PDO. But you don't need to prepare every SQL statement. Prepared statements offer two major benefits: The query only needs to be parsed (or prepared) once, but can be executed multiple times with the same or different parameters; The parameters to prepared statements don't need to be quoted, and the driver automatically handles this. So for example, if you want to execute a complicated sql statement multi-times, you'd better prepare it first.

But if there are parameters in sql statement. You should prepare the statement before you bind value to the parameter. In CUBRID PDO, it supports both positional parameter and named parameter. In CUBRID PHP, it supports positional parameter, and in CUBRID PHP 8.4.0 or higher, it also supports named parameter.

  • What type of database cursor does CUBRID support?

CUBRID supports both forward only and scrollable cursor. In CUBRID PHP, it only supports scrollable cursor. In CUBRID PDO, the default cursor type is forward only cursor, and you can change the cursor type using PDO::prepare. For example, PDO::prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL)).

  • How can we get database meta information in CUBRID PHP and PDO?

You can use cubrid_schema in CUBRID PHP and PDO::cubrid_schema in CUBRID PDO to get database schema information. There defines all kinds of schema type, including primary key, foreign keys, column attribute and so on.

  • How can I handle error in CUBRID PHP and PDO?

In CUBRID PHP, you can check if there is error or not using the return value of function. In CUBRID PDO, it offers a choice of 3 different error handling strategies: PDO::ERRMODE_SILENT, PDO::ERRMODE_WARNING and PDO::ERRMODE_EXCEPTION. PDO::ERRMODE_SILENT is the default mode.

In CUBRID PHP, you can get error information (including error facility code, error code and error message) using cubrid_error_code_facility, cubrid_error_code, and cubrid_error_msg. In CUBRID PDO, you can get error information about connection using PDO::errorCode and PDO::errorInfo, and get error information about statement using PDOStatement->errorCode and PDOStatement->errorInfo.

  • Does CUBRID support Large Object (LOB)? How can I work with LOB in CUBRID PHP and PDO?

CUBRID supports both BLOB and CLOB data type. In CUBRID PHP, you can insert LOB into CUBRID like any other ordinary data type, except that you should bind a PHP stream when you work with LOB. And you can get and read LOB using some specific functions in CUBRID PHP.

Build and Test

  • How to write and run test cases for CUBRID PHP and PDO?
    CUBRID PHP and PDO use the PHP offical method to write and run test cases. You can get detailed information at Write testcases. And you can get more information about test for CUBRID PHP and PDO at CUBRID PHP Test and CUBRID PDO Test.
  • How to get code coverage information in CUBRID PHP and PDO?
    CUBRID PHP and PDO are both written in C. So we can use gcov on Linux to get the code coverage information. Remember to add '--enable-gcov' when configuring the project.
  • How can I detect memory leak when developing the PHP extension?
    The Zend Engine provides a memory manager which is capable of tracking memory leaks in extensions and providing detailed debugging information. This tracking is disabled by default, as is thread-safety. To turn them on, pass the --enable-debug and --enable-maintainer-zts options to configure, along with whatever options you typically use.
comments powered by Disqus
Page info
viewed 2172 times
translations en
posted 6 years ago by
updated 5 years ago by
View revisions
Share this article