응용개발

CUBRID PHP 드라이버 빌드와 연동방법

by 정만영 posted Mar 07, 2018

CentOS 7 + Apache 2.4.6 + PHP 5.4.16 + CUBRID PHP 드라이버 연동하는 방법입니다.


1, Apache 설치

[root@localhost ~]# yum -y install httpd httpd-devel                                                                                         

[root@localhost ~]# /usr/sbin/httpd -v

Server version: Apache/2.4.6 (CentOS)

Server built:   Oct 19 2017 20:39:16


2, PHP 설치

[root@localhost ~]# yum -y install php php-devel php-pear                                                                                

[root@localhost ~]# php -v

PHP 5.4.16 (cli) (built: Nov 15 2017 16:33:54)

Copyright (c) 1997-2013 The PHP Group

Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies


3, CUBRID PHP 빌드에 필요한 라이브러리 설치

[root@localhost ~]# yum -y install ncurses* gcc gcc-c++ libstdc++ libtool                                                             

[root@localhost ~]# yum list ncurses* gcc gcc-c++ libstdc++ libtool


4, CUBRID PHP 드라이버 다운로드 및 압축해제

[root@localhost ~]# wget http://ftp.cubrid.org/CUBRID_Drivers/PHP_Driver/10.1.0/Linux/CUBRID-PHP-10.1.0.0003.src.tar.gz

[root@localhost ~]# tar xvfz CUBRID-PHP-10.1.0.0003.src.tar.gz


5, CUBRID PHP 드라이버 빌드

[root@localhost ~]# cd cubrid-php                                                                                                               

[root@localhost cubrid-php]# phpize

Configuring for:

PHP Api Version:         20100412

Zend Module Api No:      20100525

Zend Extension Api No:   220100525

[root@localhost cubrid-php]# ./configure

[root@localhost cubrid-php]# make


6, cubrid.so 모듈 복사

[root@localhost cubrid-php]# cd modules                                                                                                      

[root@localhost modules]# ls -al

합계 1812

drwxr-xr-x.  2 root root      40  3월  6 14:59 .

drwxrwxr-x. 13  500  500    4096  3월  6 14:59 ..

-rw-r--r--.  1 root root     922  3월  6 14:59 cubrid.la

-rwxr-xr-x.  1 root root 1845680  3월  6 14:59 cubrid.so

[root@localhost modules]# cp cubrid.* /usr/lib64/php/modules


7, php.ini 환경설정에 cubrid.so 등록

[root@localhost modules]# vi /etc/php.ini                                                                                                      

; Directory in which the loadable extensions (modules) reside.

http://php.net/extension-dir

; extension_dir = "./"

; On windows:

; extension_dir = "ext"

extension = cubrid.so


8, PHP info.php 파일 생성

[root@localhost modules]# cd /var/www/html                                                                                                 

[[root@localhost html]# echo "<?php phpinfo(); ?>" > /var/www/html/info.php


9, Apache 구동과 CUBRID PHP CCI Vserion 확인

[root@localhost html]# systemctl restart httpd                                                                                                

[root@localhost html]# systemctl status httpd

 httpd.service - The Apache HTTP Server

   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)

   Active: active (running) since 화 2018-03-06 15:22:22 KST; 8s ago

[root@localhost html]# php /var/www/html/info.php | grep CCI

CCI Version => 10.0.0


10, CUBRID 설치와 PHP 매뉴얼

참조: PHP 드라이버는 CUBRID 버전별로 관리되고 있어 DB서버에 설치한 CUBRID 버전과 같은 PHP 드라이버를 다운로드 받아 사용해 주세요.

Articles

1 2 3 4 5 6 7 8 9 10