postgresql安装plphp语言

Date 二 27 十一月 2012 By liugehao Category db.

ubuntu 下postgresql用python写存储过程,直接安装 {{{ apt-get install postgresql-plpython-9.1 #python2 apt-get install postgresql-plpython3-9.1 #python3 }}} == 用php写存储过程 == php的话只能编译安装。

{{{#!highlight bash

php安装

wget http://cn2.php.net/get/php-5.4.9.tar.bz2/from/this/mirror tar jxf mirror cd php-5.4.9 ./configure --prefix=/usr/local/php5.4.9 --enable-embed #必须embed make -j 8 make install

安装plphp

git clone http://github.com/commandprompt/PL-php.git cd PL-php ./configure --with-php=/usr/local/php5.4.9 make make install

}}} {{{#!highlight sql

psql template1

INSERT INTO pg_pltemplate VALUES ('plphp', 't', 't','plphp_call_handler','plphp_call_handler', 'plphp_validator', '$libdir/plphp.so', NULL);

CREATE FUNCTION plphp_call_handler() RETURNS LANGUAGE_HANDLER AS '$libdir/plphp.so' LANGUAGE C;

create or replace function php2(dt int,dt1 int) returns text as $body$ $t = array(1,3,4); return $dt+$dt1;

$body$ language plphp;

select php2(3,4);

}}} 使用文档 https://public.commandprompt.com/projects/plphp/documents

Comments !