plphp
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
plphp | 2.6 | LANG | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3170 | plphp | No | Yes | No | Yes | No | No | - |
| Related | plruby plperl plpython3u pllua plv8 jsonb_plphp hstore_plphp bytea_plphp |
|---|---|
| Depended By | 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.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| 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
|
Build
You can build the RPM / DEB packages for plphp using pig build:
Install
You can install plphp directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources:
plphp embeds PHP as an untrusted PostgreSQL procedural language for functions, procedures, triggers, event triggers, and anonymous blocks. Use it only when PHP APIs are worth running with the operating-system privileges of the PostgreSQL server process; it is not a sandboxed language.
Core Workflow
PL/php 2.6 supports PHP 8.1 through 8.4 using the embed SAPI without ZTS and PostgreSQL 11 through 18. Installation and creation require a superuser because the language is deliberately untrusted.
Main Interfaces
spi_exec(...),spi_prepare(...),spi_exec_prepared(...),spi_query(...), and cursor helpers access PostgreSQL through SPI.return_next()emits rows from set-returning functions.spi_commit()andspi_rollback()provide transaction control inside procedures.subtransaction(...)creates a catchable subtransaction boundary.$_TDexposes trigger and event-trigger context.$_SHAREDis session-global storage, while$_SDis private per-function session storage.plphp.on_init,plphp.start_proc, andplphp_modulesinitialize a session interpreter.
The optional jsonb_plphp, hstore_plphp, and bytea_plphp extensions add native transforms. A function must declare TRANSFORM FOR TYPE ... to use a transform; installing a companion does not change every PL/php function automatically.
Security and Operations
A PL/php function can read or write files, open network connections, invoke PHP facilities, and affect anything accessible to the PostgreSQL operating-system account. Only grant function ownership and creation rights to roles trusted like a server administrator. Apply normal SECURITY DEFINER and search_path hardening when a privileged wrapper is unavoidable.
SPI query text, dynamic identifiers, session initialization code, loaded modules, and persistent interpreter state all require review. Long-running PHP code blocks a PostgreSQL backend, and memory retained in $_SHARED or $_SD lasts for the session. Use prepared statements for untrusted values, bound resource use, test cancellation/error paths, and recycle sessions when application code retains excessive state.
Version 2.6 adds per-function $_SD and the binary-safe bytea_plphp transform. PostgreSQL tracks the control version as 2.6 while the source distribution is 2.6.0.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)