Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.4.3 |  CUBRID 9.0.0 | 

Installing and Configuring PHP

The easiest and fastest way to get all applications installed on your system is to install CUBRID, Apache web server, PHP, and CUBRID PHP driver at the same time. For details, see http://www.cubrid.org/wiki_apis/entry/install-cubrid-with-apache-and-php-on-ubuntu.

For Linux
Configuring the Environment
  • CUBRID: 2008 R3.0 (8.3.0) or later
  • Operating system: 32-bit or 64-bit Linux
  • Web server: Apache
  • PHP: 5.2 or 5.3 (http://php.net/downloads.php)
Installing CUBRID PHP Driver using PECL

If PECL package has been installed on your system, the installation of CUBRID PHP driver is straightforward. PECL will download and compile the driver for you. If you do not have PECL installed, follow the instructions at http://www.cubrid.org/wiki_apis/entry/installing-cubrid-php-driver-using-pecl to get it installed.

  1. Enter the following command to install the latest version of CUBRID PHP driver.

    sudo pecl install cubrid

    If you need earlier versions of the driver, you can install exact versions as follows:

    sudo pecl install cubrid-8.3.0.0005

    During the installation, you will be prompted to enter CUBRID base install dir autodetect :. Just to make sure your installation goes smoothly, enter the full path to the directory where you have installed CUBRID. For example, if CUBRID has been installed at /home/cubridtest/CUBRID, then enter /home/cubridtest/CUBRID.

  2. Edit the configuration file.
    • If you are using CentOS 6.0 and later or Fedora 15 and later, create a file named pdo_cubrid.ini, enter a command line extension=pdo_cubrid.so, and store the fine in the /etc/php.d directory.
    • If you are using earlier versions of CentOS 6.0 or Fedora 15, edit the php.ini file (default location: /etc/php5/apache2/ or /etc/) and add the following two command lines at the end of the file.

      [CUBRID]

      extension=cubrid.so

  3. Restart the web server to apply changes.
Installing using apt-get on Ubuntu
  1. If you do not have PHP itself installed, install it using the following command; if you have PHP installed on your system, skip this step.

    sudo apt-get install php5

  2. To install CUBRID PHP driver using apt-get, we need to add CUBRID's repository so that Ubuntu knows where to download the packages from and tell the operating system to update its indexes.

    sudo add-apt-repository ppa:cubrid/cubrid

    sudo apt-get update

  3. Now install the driver.

    sudo apt-get install php5-cubrid

    To install earlier versions, indicate the version as:

    sudo apt-get install php5-cubrid-8.3.1

    This will copy the cubrid.so driver to /usr/lib/php5/2009* and add the following configuration lines to /etc/php5/apache2/php.ini.

    [PHP_CUBRID]

    extension=cubrid.so

  4. Restart the web server so that PHP can read the module.

    service apache2 restart

Installing using Yum on Fedora/CentOS
  1. To install CUBRID PHP driver using yum command, we need to tell Yum where to look for CUBRID package. First, visit one of the following links depending on your operating system.
  2. Choose CUBRID version. You will be given a list of links for your particular version. For example, the following link is provided for Fedora 16 where fc16 means this operating system version.

    rpm -i http://yumrepository.cubrid.org/cubrid_repo_settings/9.0.0/cubridrepo-9.0.0-1.fc16.noarch.rpm

  3. For CentOS, el6.2 means CentOS version 6.2.

    rpm -i http://yumrepository.cubrid.org/cubrid_repo_settings/9.0.0/cubridrepo-9.0.0-1.el6.2.noarch.rpm

  4. Executing this command will tell Yum where to look for CUBRID package.

  5. Execute the command below to install CUBRID PHP driver.

    yum install php-cubrid

  6. Restart the web server.

    service httpd restart

For Windows
Requirements
Using CUBRID PHP Driver Installer

The CUBRID PHP API Installer is a Windows installer which automatically detects the CUBRID and PHP version and installs the proper driver for you by copying it to the default PHP extensions directory and adding the extension load directives to the php.ini file. In this section, we will explain how to use the CUBRID PHP API Installer to install the CUBRID PHP extension on Windows.

In case you want to remove the CUBRID PHP driver, you just have to run the CUBRID PHP API Installer again in uninstall mode (like any other un-installer on Windows) and it will reset all the changes made during installation.

Before you install CUBRID PHP driver, make sure that paths of PHP and CUBRID are added in the system variable, Path.

  1. Download the CUBRID PHP API installer for Windows from the link below. The current installer includes the drivers for all CUBRID versions.

    http://www.cubrid.org/?mid=downloads&item=php_driver&os=windows

  2. To install the PHP extension, run the installer. Once the installer starts, click the [Next] button.
  3. Agree with the BSD license terms and click the [Next] button.
  4. Choose where you would like to install this CUBRID PHP API Installer and click the [Next] button. You should choose a new folder for this installer like like C:Program FilesCUBRID PHP API.
  5. Give a folder name and click the [Install] button. If you fail installation, you should probably receive an error message. In this case, see Add Environment Variables to System PATH below.
  6. If no error message is displayed, this should install the CUBRID PHP extension and update your php.ini file. Click [Finish] to close the installer.
  7. For changes to take place, restart your web server and execute the phpinfo() to confirm CUBRID has successfully been installed.

    api_php_install_phpinfo.png

Configuring the environment

If you have received an error messages, follow the steps below; if you can see CUBRID in phpinfo(), you do not need to look further. By default, when you install CUBRID, it automatically adds its installation directory to the Path system environment variable. To verify the variable have been correctly configured, launch the command prompt ([Start] > [Programs] > [Accessories] > [Command Prompt]) and enter the following commands one by one.

  1. Enter command below in the command prompt as follows.

    php --version

    You can see the PHP version like below if it is properly configured.

    C:UsersAdministrator>php --version

    PHP 5.2.9 <cli> <built: Feb 25 2009 15:52:24>

  2. Enter command as follows.  

    php --version

    You can see the CUBIRD version like below if it is properly configured.

    C:UsersAdministrator>cubrid --version

    cubrid <cubrid utilities> R2.1

If you can not get the result like above, it is highly likely that your PHP and CUBRID installations went wrong. Try to reinstall them and recheck again. If the path is not automatically specified even after you complete reinstallation, you can do it manually.

  1. Right-click [My Computer] and select [Properties]. The [System Properties] dialog box will appear.
  2. Go to [Advanced] tab and click on [Environment Variables].
  3. Select the variable called Path in the [System variables] box and click [Edit] button. You will notice that the value of that variable contains system paths separated by semi-colon.
  4. Add the paths for CUBRID and PHP in that variable. For example, if PHP is installed in C:Program FilesPHP and also CUBRID in C:CUBRIDbin, you will have to append (do not overwrite, just append) these values to the path like C:CUBRIDbin;C:Program FilesPHP.
  5. Click [OK] to save and close the dialog box.
  6. To confirm you have done everything correct, check the variable presence in the command prompt.
Downloading and Installing Compiled CUBRID PHP Driver

First, download CUBRID PHP/PDO driver of which versions match the versions of your operating system and PHP installed from  http://www.cubrid.org/?mid=downloads&item=php_driver&os=windows&php=detect&driver=detect.

After you download the driver, you will see the php_cubrid.dll file for CUBRID PHP driver or the php_pdo_cubrid.dll file for CUBRID PDO driver. Follow the steps below to install it.

  1. Copy this driver to the default PHP extensions directory (usually located at C:Program FilesPHPext).
  2. Set your system environment. Check if the environment variable PHPRC is C:Program FilesPHP and system variable path is added with %PHPRC% and %PHPRCext.
  3. Edit php.ini (C:Program FilesPHPphp.ini) and add the following two command lines at the end of the php.ini file.

    [PHP_CUBRID]

    extension=php_cubrid.dll

    For CUBRID PDO driver, add command lines below.

    [PHP_PDO_CUBRID]

    extension = php_pdo_cubrid.dll

  4. Restart your web server to apply changes.

Note To get the latest information information about PHP driver, click http://www.cubrid.org/wiki_apis/entry/cubrid-php-driver.