plphp
概览
| 扩展包名 | 版本 | 分类 | 许可证 | 语言 |
|---|---|---|---|---|
plphp | 2.6 | LANG | PostgreSQL | C |
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 3170 | plphp | 否 | 是 | 否 | 是 | 否 | 否 | - |
| 相关扩展 | plruby plperl plpython3u pllua plv8 jsonb_plphp hstore_plphp bytea_plphp |
|---|---|
| 下游依赖 | bytea_plphp hstore_plphp jsonb_plphp |
Uses non-ZTS PHP embed. EL8/EL9 RPMs require the PHP 8.2/8.3 module streams respectively; DEBs pin the matching PHP embed runtime for each OS. No preload or fixed schema. The three optional transforms are not included in this package.
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 2.6 | 1817161514 | plphp | - |
| RPM | PIGSTY | 2.6 | 1817161514 | plphp_$v | php-embedded |
| DEB | PIGSTY | 2.6 | 1817161514 | postgresql-$v-plphp | libphp-embed |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 2.6 el8.x86_64.pg18 : plphp_18 plphp_18-2.6-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.6 el8.x86_64.pg17 : plphp_17 plphp_17-2.6-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.6 el8.x86_64.pg16 : plphp_16 plphp_16-2.6-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.6 el8.x86_64.pg15 : plphp_15 plphp_15-2.6-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.6 el8.x86_64.pg14 : plphp_14 plphp_14-2.6-1PGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 2.6 el8.aarch64.pg18 : plphp_18 plphp_18-2.6-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.6 el8.aarch64.pg17 : plphp_17 plphp_17-2.6-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.6 el8.aarch64.pg16 : plphp_16 plphp_16-2.6-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.6 el8.aarch64.pg15 : plphp_15 plphp_15-2.6-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.6 el8.aarch64.pg14 : plphp_14 plphp_14-2.6-1PGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 2.6 el9.x86_64.pg18 : plphp_18 plphp_18-2.6-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.6 el9.x86_64.pg17 : plphp_17 plphp_17-2.6-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.6 el9.x86_64.pg16 : plphp_16 plphp_16-2.6-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.6 el9.x86_64.pg15 : plphp_15 plphp_15-2.6-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.6 el9.x86_64.pg14 : plphp_14 plphp_14-2.6-1PGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 2.6 el9.aarch64.pg18 : plphp_18 plphp_18-2.6-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.6 el9.aarch64.pg17 : plphp_17 plphp_17-2.6-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.6 el9.aarch64.pg16 : plphp_16 plphp_16-2.6-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.6 el9.aarch64.pg15 : plphp_15 plphp_15-2.6-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.6 el9.aarch64.pg14 : plphp_14 plphp_14-2.6-1PGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 2.6 el10.x86_64.pg18 : plphp_18 plphp_18-2.6-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.6 el10.x86_64.pg17 : plphp_17 plphp_17-2.6-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.6 el10.x86_64.pg16 : plphp_16 plphp_16-2.6-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.6 el10.x86_64.pg15 : plphp_15 plphp_15-2.6-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.6 el10.x86_64.pg14 : plphp_14 plphp_14-2.6-1PGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 2.6 el10.aarch64.pg18 : plphp_18 plphp_18-2.6-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.6 el10.aarch64.pg17 : plphp_17 plphp_17-2.6-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.6 el10.aarch64.pg16 : plphp_16 plphp_16-2.6-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.6 el10.aarch64.pg15 : plphp_15 plphp_15-2.6-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.6 el10.aarch64.pg14 : plphp_14 plphp_14-2.6-1PGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 2.6 d12.x86_64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.6 d12.x86_64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.6 d12.x86_64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.6 d12.x86_64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.6 d12.x86_64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 2.6 d12.aarch64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.6 d12.aarch64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.6 d12.aarch64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.6 d12.aarch64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.6 d12.aarch64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 2.6 d13.x86_64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~trixie_amd64.deb
| PIGSTY 2.6 d13.x86_64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~trixie_amd64.deb
| PIGSTY 2.6 d13.x86_64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~trixie_amd64.deb
| PIGSTY 2.6 d13.x86_64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~trixie_amd64.deb
| PIGSTY 2.6 d13.x86_64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 2.6 d13.aarch64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~trixie_arm64.deb
| PIGSTY 2.6 d13.aarch64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~trixie_arm64.deb
| PIGSTY 2.6 d13.aarch64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~trixie_arm64.deb
| PIGSTY 2.6 d13.aarch64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~trixie_arm64.deb
| PIGSTY 2.6 d13.aarch64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 2.6 u22.x86_64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~jammy_amd64.deb
| PIGSTY 2.6 u22.x86_64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~jammy_amd64.deb
| PIGSTY 2.6 u22.x86_64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~jammy_amd64.deb
| PIGSTY 2.6 u22.x86_64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~jammy_amd64.deb
| PIGSTY 2.6 u22.x86_64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 2.6 u22.aarch64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~jammy_arm64.deb
| PIGSTY 2.6 u22.aarch64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~jammy_arm64.deb
| PIGSTY 2.6 u22.aarch64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~jammy_arm64.deb
| PIGSTY 2.6 u22.aarch64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~jammy_arm64.deb
| PIGSTY 2.6 u22.aarch64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 2.6 u24.x86_64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~noble_amd64.deb
| PIGSTY 2.6 u24.x86_64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~noble_amd64.deb
| PIGSTY 2.6 u24.x86_64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~noble_amd64.deb
| PIGSTY 2.6 u24.x86_64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~noble_amd64.deb
| PIGSTY 2.6 u24.x86_64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 2.6 u24.aarch64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~noble_arm64.deb
| PIGSTY 2.6 u24.aarch64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~noble_arm64.deb
| PIGSTY 2.6 u24.aarch64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~noble_arm64.deb
| PIGSTY 2.6 u24.aarch64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~noble_arm64.deb
| PIGSTY 2.6 u24.aarch64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 2.6 u26.x86_64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~resolute_amd64.deb
| PIGSTY 2.6 u26.x86_64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~resolute_amd64.deb
| PIGSTY 2.6 u26.x86_64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~resolute_amd64.deb
| PIGSTY 2.6 u26.x86_64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~resolute_amd64.deb
| PIGSTY 2.6 u26.x86_64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 2.6 u26.aarch64.pg18 : postgresql-18-plphp postgresql-18-plphp_2.6-1PGSTY~resolute_arm64.deb
| PIGSTY 2.6 u26.aarch64.pg17 : postgresql-17-plphp postgresql-17-plphp_2.6-1PGSTY~resolute_arm64.deb
| PIGSTY 2.6 u26.aarch64.pg16 : postgresql-16-plphp postgresql-16-plphp_2.6-1PGSTY~resolute_arm64.deb
| PIGSTY 2.6 u26.aarch64.pg15 : postgresql-15-plphp postgresql-15-plphp_2.6-1PGSTY~resolute_arm64.deb
| PIGSTY 2.6 u26.aarch64.pg14 : postgresql-14-plphp postgresql-14-plphp_2.6-1PGSTY~resolute_arm64.deb
|
构建
您可以使用 pig build 命令构建 plphp 扩展的 RPM / DEB 包:
安装
您可以直接安装 plphp 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
使用 pig 或者是 apt/yum/dnf 安装扩展:
创建扩展:
用法
来源:
plphp 把 PHP 作为非可信 PostgreSQL 过程语言嵌入,用于函数、过程、触发器、事件触发器与匿名块。只有在确实需要 PHP API、并能接受代码以 PostgreSQL 服务器操作系统权限运行时才应使用;它不是沙箱语言。
核心流程
PL/php 2.6 支持使用非 ZTS embed SAPI 的 PHP 8.1 至 8.4,以及 PostgreSQL 11 至 18。由于该语言明确属于非可信语言,安装与创建都需要超级用户。
主要接口
spi_exec(...)、spi_prepare(...)、spi_exec_prepared(...)、spi_query(...)与游标辅助函数通过 SPI 访问 PostgreSQL。return_next()从集合返回函数输出行。spi_commit()与spi_rollback()在过程中提供事务控制。subtransaction(...)创建可捕获的子事务边界。$_TD暴露触发器与事件触发器上下文。$_SHARED是会话全局存储,$_SD是每个函数私有的会话存储。plphp.on_init、plphp.start_proc与plphp_modules用于初始化会话解释器。
可选的 jsonb_plphp、hstore_plphp 与 bytea_plphp 扩展提供原生转换。函数必须声明 TRANSFORM FOR TYPE ... 才会使用转换;安装配套扩展不会自动改变所有 PL/php 函数。
安全与运维
PL/php 函数可以读写文件、打开网络连接、调用 PHP 能力,并影响 PostgreSQL 操作系统账户可访问的一切。函数所有权与创建权只能授予等同服务器管理员信任级别的角色。若不得不使用高权限包装器,应按常规加固 SECURITY DEFINER 与 search_path。
SPI 查询文本、动态标识符、会话初始化代码、加载模块与持久解释器状态都需要审查。长时间运行的 PHP 代码会阻塞 PostgreSQL 后端,$_SHARED 或 $_SD 中保留的内存会持续到会话结束。对不可信值应使用预备语句,限制资源用量,测试取消与错误路径,并在应用代码保留过多状态时回收会话。
2.6 新增每函数 $_SD 与二进制安全的 bytea_plphp 转换。PostgreSQL 记录的控制版本是 2.6,源码发行包版本是 2.6.0。
这个页面对您有帮助吗?
感谢反馈,我们会据此改进这篇文档。
哪里没有解决?(可选)