Composer php Composer安装缺少的curl ext
我正在Ubuntu 14.04.4 LS上开发一些PHP。运行Composer php Composer安装缺少的curl ext,composer-php,php-curl,Composer Php,Php Curl,我正在Ubuntu 14.04.4 LS上开发一些PHP。运行composer安装失败,我无法解决。这在我之前使用PHP5.5.9时是有效的,但我必须更新到至少5.6才能安装phpunit 运行php-v输出: PHP 5.6.23-1+deb.sury.org~trusty+2 (cli) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies wi
composer安装
失败,我无法解决。这在我之前使用PHP5.5.9时是有效的,但我必须更新到至少5.6才能安装phpunit
运行php-v
输出:
PHP 5.6.23-1+deb.sury.org~trusty+2 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
/usr/bin/php
Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini
php5-curl is already the newest version.
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
运行php输出的:
PHP 5.6.23-1+deb.sury.org~trusty+2 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
/usr/bin/php
Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini
php5-curl is already the newest version.
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
这有点可疑,因为它不匹配php-v
(/usr/bin有:“php”、“php5”和“php5.6”)
这是我的composer.json:
{
"require-dev": {
"phpunit/phpunit": "5.4.*"
},
"require": {
"silex/silex": "~1.3",
"stripe/stripe-php": "3.*"
}
}
运行composer安装
将创建此输出:
$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- stripe/stripe-php v3.9.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.9.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.9.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.8.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.7.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.7.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.6.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.5.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.4.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.3.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.2.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.13.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.12.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.12.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.11.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.10.1 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.10.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.1.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.0.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- stripe/stripe-php v3.14.2 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- Installation request for stripe/stripe-php 3.* -> satisfiable by stripe/stripe-php[v3.0.0, v3.1.0, v3.10.0, v3.10.1, v3.11.0, v3.12.0, v3.12.1, v3.13.0, v3.14.0, v3.14.1, v3.14.2, v3.14.3, v3.2.0, v3.3.0, v3.4.0, v3.5.0, v3.6.0, v3.7.0, v3.7.1, v3.8.0, v3.9.0, v3.9.1, v3.9.2].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/5.6/cli/php.ini
- /etc/php/5.6/cli/conf.d/10-opcache.ini
- /etc/php/5.6/cli/conf.d/10-pdo.ini
- /etc/php/5.6/cli/conf.d/20-calendar.ini
- /etc/php/5.6/cli/conf.d/20-ctype.ini
- /etc/php/5.6/cli/conf.d/20-exif.ini
- /etc/php/5.6/cli/conf.d/20-fileinfo.ini
- /etc/php/5.6/cli/conf.d/20-ftp.ini
- /etc/php/5.6/cli/conf.d/20-gettext.ini
- /etc/php/5.6/cli/conf.d/20-iconv.ini
- /etc/php/5.6/cli/conf.d/20-json.ini
- /etc/php/5.6/cli/conf.d/20-phar.ini
- /etc/php/5.6/cli/conf.d/20-posix.ini
- /etc/php/5.6/cli/conf.d/20-readline.ini
- /etc/php/5.6/cli/conf.d/20-shmop.ini
- /etc/php/5.6/cli/conf.d/20-sockets.ini
- /etc/php/5.6/cli/conf.d/20-sysvmsg.ini
- /etc/php/5.6/cli/conf.d/20-sysvsem.ini
- /etc/php/5.6/cli/conf.d/20-sysvshm.ini
- /etc/php/5.6/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
我按照以下说明操作,但不起作用:
运行php-i | grep php.ini
输出:
PHP 5.6.23-1+deb.sury.org~trusty+2 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
/usr/bin/php
Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini
php5-curl is already the newest version.
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
正在运行:sudo apt get install php5 curl
输出:
PHP 5.6.23-1+deb.sury.org~trusty+2 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
/usr/bin/php
Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini
php5-curl is already the newest version.
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
运行curl-V
输出:
PHP 5.6.23-1+deb.sury.org~trusty+2 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
/usr/bin/php
Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini
php5-curl is already the newest version.
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
非常感谢您的帮助。请注意:
- 运行
php-i
很好。它向您显示所使用的php.ini
,以便您知道要编辑哪个文件
- 不需要运行
curl-v
,因为这是在CLI上使用的独立curl,与PHP扩展curl无关
- 您检查了
php5 curl
,这是所需的包。嗯
少了什么?您需要确保扩展也是由PHP加载的
编辑/etc/php/5.6/cli/php.ini
,搜索扩展名
,查找php\u curl
并启用它:扩展名=php\u curl.so
然后在CLI上运行php-m
,查看已加载模块的列表并确保已加载curl
最后,如果ubuntu不是服务器版,并且Web服务器安装了tasksel
尝试安装php
apt get install php
执行以下操作:
sudo apt get install php curl
感谢您的回复。ini文件没有php_curl.so——它有php_curl.dll,但这是针对windows的,我在Ubuntu上。启用此行不起作用。这个文件只有两个,所以提到了mysql。我从phpinfo()中得到了“extensions_dir”,该目录中有一个“curl.so”。我也遵循了这里的说明:文件/etc/php5/mods available/curl.ini确实存在,并且其中有“extension=curl.so”。更新上面的问题。好的,在Linux/Ubuntu上时,您需要启用.so
文件。我想知道,既然您已经在扩展文件夹中找到了php\u curl.so
文件,为什么启用它不起作用。如果已加载,请使用php-m检查如果没有加载,我认为您仍然在为您在CLI上使用的php编辑错误的php.ini
。请记住,对于web请求和CLI,存在不同的php.ini文件。php-m
不列出curl。命令php-i | grep php.ini
让我觉得我正在编辑正确的php.ini文件。在php.ini文件中,我添加了extension=/path/to/extensions/curl.so
(从phpinfo()
的输出中获得了路径),现在php-m
列出了curl。现在,当我运行composer install
时,我发现另一个丢失的软件包(ext mbstring)出现了一个错误,所以这似乎是可行的。但是,我不断收到错误的事实让我觉得有些问题。键入dpkg-l | grep'php5 curl'
输出:ii php5 curl 5.6.23+dfsg-1+deprecated+dontuse+deb.sury.org~trusty+1 amd64 curl php5模块
。注意这里有“deprecated+dontuse”。当升级我的PHP版本时,它并没有顺利进行,我看到了这个“不推荐”的消息,并再次升级到更高的版本。也许我会卸载所有PHP并重新开始。很高兴它成功了好的,如果正确加载了curl扩展,并且没有显示PHP扩展和PHP核心之间的API冲突,那么当您运行PHP时,它就可以正常工作——即使它被标记为不推荐使用如果API不匹配,那么重新安装带有扩展的PHP可能会消除这种情况。键入dpkg-l | grep'php5 curl'
输出:ii php5 curl 5.6.23+dfsg-1+弃用+dontuse+deb.sury.org~trusty+1 amd64 curl模块获取php5
相关答案。感谢发布