Install the Phpbrew
brew install phpbrew
Install the latest SQLite with built-in SQL match function like (acros)
CPPFLAGS=-DSQLITE_ENABLE_MATH_FUNCTIONS brew install sqlite --build-from-source
Install the PHP version with latest SQLite
LDFLAGS="-L/usr/local/opt/sqlite/lib" CPPFLAGS="-I/usr/local/opt/sqlite/include" phpbrew install 7.4.18 +default +dbs
Set the current installed PHP to default version
phpbrew switch 7.4.18
Check the PHP version
php -v
Check the installed SQLite version in PHP
php -r "echo SQLite3::version()['versionString'];"