Best practice for multiple versions of PHP on one server #1586
-
Hello. What's not currently clear to me is the best way forward to provide Unit support for each version of PHP. Does each instance of PHP need its own binary + module, or can multiple versions of the same language be baked-in at compile time? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you have multiple versions of PHP installed then you can build a Basically you'd $ ./configure php --module=php-version --config=/path/to/php-config --lib-path=/path/to/php_lib_dir
$ make && make install for each version you wish to build support for, where Then in your unit config you'd reference these versions via the The E.g. $ curl --unix-socket /opt/unit/control.unit.sock http://localhost/status/modules
{
"modules": {
"python": [
{
"version": "3.12.3",
"lib": "/opt/unit/modules/python.unit.so"
},
{
"version": "3.12.1",
"lib": "/opt/unit/modules/python-3.12.1.unit.so"
}
],
"wasm": {
"version": "0.1",
"lib": "/opt/unit/modules/wasm.unit.so"
},
"wasm-wasi-component": {
"version": "0.1",
"lib": "/opt/unit/modules/wasm_wasi_component.unit.so"
}
}
} |
Beta Was this translation helpful? Give feedback.
If you have multiple versions of PHP installed then you can build a
php-version.unit.so
for each version you want, unit will load all these at runtime.Basically you'd
for each version you wish to build support for, where
php-version
is likephp-8.4
which would create aphp-8.4.unit.so
DSO.Then in your unit config you'd reference these versions via the
application.name.type
setting where each type would be something likephp 8.4
,php 7.2
etcThe
/status/modules
endpoint can be used to see what language modules unit has loadedE.g.
$ curl --unix-socket /opt/unit/contr…