已安装NGINX - CURL扩展,但系统显示它已丢失

时间:2016-12-27 12:02:21

标签: php ubuntu curl nginx composer-php

我正在尝试使用composer更新Laravel项目,但系统说:

Problem 1

- Installation request for netshell/paypal dev-master -> satisfiable by netshell/paypal[dev-master].
- netshell/paypal dev-master requires ext-curl * -> the requested PHP extension curl is missing from your system.

To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/5.6/cli/php.ini
- /etc/php/5.6/cli/conf.d/10-mysqlnd.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/15-xml.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-dom.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-mbstring.ini
- /etc/php/5.6/cli/conf.d/20-mcrypt.ini
- /etc/php/5.6/cli/conf.d/20-mysql.ini
- /etc/php/5.6/cli/conf.d/20-mysqli.ini
- /etc/php/5.6/cli/conf.d/20-pdo_mysql.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-simplexml.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
- /etc/php/5.6/cli/conf.d/20-wddx.ini
- /etc/php/5.6/cli/conf.d/20-xmlreader.ini
- /etc/php/5.6/cli/conf.d/20-xmlwriter.ini
- /etc/php/5.6/cli/conf.d/20-xsl.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

机器是: Ubuntu 14.04 Nginx的 PHP 5.6

我已经做了很多步骤,如:

  • apt-get install curl
  • apt-get install php-curl
  • service php5-fpm restart
  • service nginx restart

仍然没有工作......

我还有curl.ini文件:

; configuration for php CURL module
; priority=20
extension=curl.so

我的phpinfo说启用了curl:

enter image description here

我还能做些什么?

1 个答案:

答案 0 :(得分:2)

composer和nginx使用不同的PHP解释器。您为 php-fpm 启用了php-curl,但 php-cli 则没有。

您可以通过运行php --ini来确定 php-cli 使用的实际配置文件(并且您可能会看到curl.ini不在其中)

启用它,例如:

sudo ln -s /etc/php/5.6/mods-available/curl.ini /etc/php/5.6/cli/conf.d/20-curl.ini

注意:第一个参数应该是curl.ini文件的实际位置。所以它也可能是

sudo ln -s /etc/php5/mods-available/curl.ini /etc/php/5.6/cli/conf.d/20-curl.ini

如果您的运行php --info | grep curl -C 3,您将看到是否实际为您的php-cli安装启用了curl。