【发布时间】:2022-01-08 15:03:15
【问题描述】:
通过 brew 安装 php,按照这样的说明进行操作
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`).
启用 php 和 this 对 php.so 进行签名。
之后,当我运行 apachectl configtest 时,我得到了 error 像这样
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_extension\n Referenced from: /usr/local/Cellar/php/8.1.0/lib/httpd/modules/libphp.so\n Expected in: /usr/lib/libsqlite3.dylib
我该怎么办?
【问题讨论】:
标签: php macos apache homebrew macos-monterey