Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Build PHP7 with lmdb support (or another needed) on MacOS in Homebrew

This method is suitable for compiling PHP from the source code not only for LMDB, but also through it you can perform any kind of configuration before installation.

Install lmdb

Unfortunately, it is currently not possible to change the database size and it is fixed at a size of 1MB (this restriction is defined in the library itself). To get around this, you need to patch the library itself before installation. Look here as:

Proper way (not worked)

Build php7 from sources

--interactive: Download and patch formula, then open a shell. This allows the user to run ./configure --help and otherwise determine how to turn the software package into a Homebrew package.

brew install --build-from-source --interactive php

==> Installing php ==> Downloading ==> Patching patching file acinclude.m4 Hunk #5 succeeded at 2504 (offset 85 lines). ==> Entering interactive mode Type exit to return and finalize the installation Install to this prefix: /usr/local/Cellar/php/7.3.11 ➜ php-7.3.11 #

./configure --with-lmdb=/usr/local/opt/lmdb
# ??? 
# need more args in `configure` or `make install`?
make test

Hacker-style way

Update brew & patch formula

brew update
brew edit php

Need find --enable-dba and add below:


Build from sources

brew install --build-from-source php


In another terminal tab

php -v
php -i | grep lmdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.