Can’t find symbol sqlite3_enable_load_extension after install PHP on macOS Monterey via brew

  apache, homebrew, macos, macos-monterey, php

install php via brew, follow the instructions like this

To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php_module /usr/local/opt/php/lib/httpd/modules/libphp.so

    <FilesMatch .php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /usr/local/etc/php/8.1/

To restart php after an upgrade:
  brew services restart php
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/php/sbin/php-fpm --nodaemonize
==> Summary
🍺  /usr/local/Cellar/php/8.1.0: 512 files, 79.9MB
==> Running `brew cleanup php`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

to enable php and this to sign the php.so.

After this, when i run apachectl configtest, I got error like this
httpd: Syntax error on line 190 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/Cellar/php/8.1.0/lib/httpd/modules/libphp.so into server: dlopen(/usr/local/Cellar/php/8.1.0/lib/httpd/modules/libphp.so, 0x000A): Symbol not found: _sqlite3_enable_load_extensionn Referenced from: /usr/local/Cellar/php/8.1.0/lib/httpd/modules/libphp.son Expected in: /usr/lib/libsqlite3.dylib

what should i do?

Source: Ask PHP

LEAVE A COMMENT