【发布时间】: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