首页 > 解决方案 > 在 Manjaro (Arch Linux) 上安装 Magento 2 ~ 缺少 php 扩展

问题描述

我正在我的系统上安装 Magento 2,经过大量的摆弄,我终于进入了 localhost 设置向导。在readiness-check-install界面出现如下问题(网上有几个解决方案,大部分我都试过了):

在此处输入图像描述

错误: 1 缺少 PHP 扩展:PHP 扩展 curl 重要的部分是我为此使用 Manjaro,这是一个 Arch Linux 发行版。

1:问题是, arch linux包商店中根本没有php-curl包,我认为curl扩展已经安装了php。 

2:我检查了我的php.ini文件,没有extension=php_curl的行,只有extension=curl。

3:php -m打印:

php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_dblib
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
phpdbg_webhelper
posix
pspell
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

4:我用 brew for linux 安装了所有东西,所以我可以像这样检查 php 包:

brew info php@7.3
php@7.3: stable 7.3.13 (bottled) [keg-only]
General-purpose scripting language
https://www.php.net/
/home/linuxbrew/.linuxbrew/Cellar/php@7.3/7.3.13 (520 files, 86.2MB)
Poured from bottle on 2020-01-10 at 10:32:22
From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/php@7.3.rb
==> Dependencies
Build: httpd ✘, pkg-config ✘, xz ✔
Required: apr ✔, apr-util ✔, argon2 ✔, aspell ✔, autoconf ✔, curl-openssl ✔, freetds ✔, freetype ✔, gettext ✔, glib ✔, gmp ✔, icu4c ✔, jpeg ✔, libpng ✔, libpq ✔, libsodium ✔, libzip ✔, openldap ✔, openssl@1.1 ✔, sqlite ✔, tidy-html5 ✔, unixodbc ✔, webp ✔, bzip2 ✔, libedit ✔, libxml2 ✔, libxslt ✔, zlib ✔
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /home/linuxbrew/.linuxbrew/opt/php@7.3/lib/httpd/modules/libphp7.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:
/home/linuxbrew/.linuxbrew/etc/php/7.3/

php@7.3 is keg-only, which means it was not symlinked into /home/linuxbrew/.linuxbrew,
because this is an alternate version of another formula.

If you need to have php@7.3 first in your PATH run:
echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/php@7.3/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/php@7.3/sbin:$PATH"' >> ~/.zshrc

For compilers to find php@7.3 you may need to set:
export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/php@7.3/lib"
export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/php@7.3/include"


Warning: php@7.3 provides a launchd plist which can only be used on macOS!
You can manually execute the service instead with:
php-fpm
==> Analytics
install: 75 (30 days), 96 (90 days), 96 (365 days)
install-on-request: 75 (30 days), 96 (90 days), 96 (365 days)
build-error: 0 (30 days)

我真的不知道如何防止这个错误。

标签: phpmagento2httpd.confphp-curlmanjaro

解决方案


我相信 ext-curl 是 Arch 的核心 PHP 包的一部分,这就是为什么你在 pacman 中找不到它的原因。我不认为它默认启用,您需要编辑相应的 /etc/php/php.ini 文件。您可能希望;extension=curl在 php-fpm.ini 中取消注释。您可能需要设置extension_dir,但这对于 Arch/pacman 来说不太可能。

我刚刚注意到您正在使用 brew for linux ......为什么?这甚至得到 Arch 的支持吗?你可以检查 /home/linuxbrew/.linuxbrew/etc/php/7.3/ 位置,看看为什么 curl 没有启用,或者只使用 pacman。请注意,cli 和 fpm 运行时有一个单独的 ini 文件。


推荐阅读