【问题标题】:Magento 2 installation on Manjaro (Arch Linux) ~ php extension missing在 Manjaro (Arch Linux) 上安装 Magento 2 ~ 缺少 php 扩展
【发布时间】:2020-04-28 00:47:46
【问题描述】:

我正在我的系统上安装 Magento 2,经过一番折腾,我终于进入了 localhost 设置向导。在readiness-check-install屏幕出现以下问题(网上有几个解决方案,大部分我都试过了):

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

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

2:我检查了我的 php.ini 文件,没有一行扩展名=php_curl,只有扩展名=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)

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

【问题讨论】:

  • 您实际使用的是哪个版本的 PHP?通过包管理安装的还是使用 brew 安装的?您是否检查过您的服务器上是否安装了 cURL(不是 PHP 的 cURL 扩展)?
  • 感谢回复,我贴了安装画面的图片,那里可以看到php版本:)
  • Nico 想说的是可能安装了 2 个 php,因此请检查 magento 使用的是哪一个,并据此检查 curl 扩展名
  • 我安装了两个php,但另一个是7.4.1版本,我用yay安装的。 Magento 使用的是 7.3.13 版本,这是与 brew 一起安装的版本(见上面的日志)。
  • 该屏幕截图无法回答您实际尝试检查的所有 cURL 要求。此外,php -v 告诉您什么 - 也许您已经列出了为 PHP 7.4 安装的模块?

标签: php magento2 httpd.conf php-curl manjaro


【解决方案1】:

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

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

【讨论】:

  • 嗨,我通常使用 pacman 或 yay,但是对于这个安装,为了方便起见,我使用了 brew,使用 pacman 我必须手动执行一些操作,并且 brew 甚至会在安装后列出步骤以使软件包工作,所以我不必搜索所有内容:D
猜你喜欢
  • 2016-06-25
  • 2019-05-20
  • 2017-10-01
  • 2018-12-23
  • 2016-07-31
  • 2018-07-09
  • 2011-06-14
  • 1970-01-01
  • 2018-08-31
相关资源
最近更新 更多