diff --git a/notes/install-php-pecl-modules.md b/notes/install-php-pecl-modules.md index aa8932d..659ce05 100644 --- a/notes/install-php-pecl-modules.md +++ b/notes/install-php-pecl-modules.md @@ -27,3 +27,43 @@ upcp -sb php/install-extensions cd /usr/local/apnscp/resources/playbooks ansible-playbook bootstrap.yml --tags=php/install-extensions --extra-vars=php_version=7.4 --extra-vars=multiphp_build=true ``` + +## Custom build flags + +There may be some cases that require custom build flags to be used during build, such as compiling `redis` with `igbinary` compatibility (required i.e. when using Object Cache Pro on WordPress). + +To build PECL modules with custom flags, you'll have to use the dense format as scope input: + +```bash +cpcmd scope:set cp.bootstrapper pecl_extensions '["imagick","igbinary","zstd",'\''{"name":"redis","flags":"--enable-redis-igbinary --enable-redis-zstd","extension":"redis"}'\'']' +``` + +Specifically, the chosen configuration for the `redis` module is: + +```json +{ + "name": "redis", + "flags": "--enable-redis-igbinary --enable-redis-zstd", + "extension": "redis" +} +``` + +This will result in `redis` being built with `igbinary` as a serializer, and `zstd` as a compression algorithm. + + + +Escaping quotes can become elaborate very quickly. Refer to [original docs for guidelines](https://docs.apiscp.com/admin/PHP-FPM/#dense-extension-format) and pay maximum attention. + + + +Once the extensions to be installed are defined, proceed with building the modules or rebuilding them if previously build: + +```bash +upcp -sb php/install-extensions +upcp -sbf php/install-extensions # Force / rebuild +``` + + +Learn more about dense format option. + +