-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathINSTALL
More file actions
79 lines (50 loc) · 2.6 KB
/
Copy pathINSTALL
File metadata and controls
79 lines (50 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
PL/php Installation
===================
PL/php builds with PostgreSQL's standard extension build infrastructure (PGXS)
and links against the PHP "embed" SAPI.
1. Prerequisites
----------------
* PostgreSQL 11 or newer (tested on 11-18), including the server development files that provide
pg_config (Debian/Ubuntu: postgresql-server-dev-NN; RPM: postgresqlNN-devel).
* PHP 8.x built with the embed SAPI and with thread safety (ZTS) DISABLED,
plus its development files (php-config).
On Debian/Ubuntu:
sudo apt-get install php8.3-dev libphp8.3-embed
You can confirm the build is suitable with:
php-config --php-sapis # must list "embed"
php -i | grep 'Thread Safety' # must say "disabled"
If your distribution does not package the embed SAPI, build PHP from source
with: ./configure --enable-embed ... (and without --enable-zts).
* A C compiler and GNU make.
2. Build and install
---------------------
make
sudo make install
The Makefile locates PostgreSQL via pg_config and PHP via php-config, both taken
from PATH. Override them if needed:
make PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config PHP_CONFIG=/usr/bin/php-config
sudo make PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config install
Note: if several libphpX.Y-embed versions are installed side by side, some
packagings (e.g. deb.sury.org) give them all the same SONAME (libphp.so), so
the backend loads whatever /usr/lib/libphp.so points at -- regardless of the
version linked at build time. Keep a single embed package installed, or
point that symlink at the intended version.
This installs the shared library plphp.so plus the extension control and SQL
files into the directories reported by pg_config.
The optional jsonb transform (CREATE EXTENSION jsonb_plphp; see
doc/plphp.md) builds the same way in its own directory:
make -C jsonb_plphp PG_CONFIG=... PHP_CONFIG=...
sudo make -C jsonb_plphp PG_CONFIG=... install
3. Enable the language in a database
------------------------------------
CREATE EXTENSION plphp;
PL/php is an untrusted language, so the extension is superuser-only to install
and only superusers can create PL/php functions. See the SECURITY NOTE in
README for why.
4. Run the regression tests (optional)
--------------------------------------
Against a running server whose pg_config is on PATH (or passed via PG_CONFIG):
make installcheck
The suite installs the extension and exercises scalar functions, arrays,
composite/record types, triggers, set-returning functions, SPI, argument
handling (IN/OUT/INOUT/TABLE, named parameters) and the validator.