在ubuntu

时间:2017-10-02 05:58:45

标签: php laravel ubuntu

我有PHP版本:

php -v
PHP 7.1.9-1

作曲家版本:

Composer version 1.5.2 2017-09-11 16:59:25

现在 我收到这个错误,我无法解决这个问题,因为我是这项技术的新手。

 composer global require "laravel/installer"
    Changed current directory to /home/indous-ubuntu/.composer
    Using version ^1.4 for laravel/installer
    ./composer.json has been updated
    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
        - laravel/installer v1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
        - laravel/installer v1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
        - Installation request for laravel/installer ^1.4 -> satisfiable by laravel/installer[v1.4.0, v1.4.1].

      To enable extensions, verify that they are enabled in your .ini files:
        - /etc/php/7.1/cli/php.ini
        - /etc/php/7.1/cli/conf.d/10-mysqlnd.ini
        - /etc/php/7.1/cli/conf.d/10-opcache.ini
        - /etc/php/7.1/cli/conf.d/10-pdo.ini
        - /etc/php/7.1/cli/conf.d/15-xml.ini
        - /etc/php/7.1/cli/conf.d/20-calendar.ini

      You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

    Installation failed, reverting ./composer.json to its original content.

如果有人知道这个问题是什么,请帮我解决这个问题!

提前致谢!

3 个答案:

答案 0 :(得分:0)

编辑composer.json文件并替换为

"require": {
    "laravel/framework": "4.2.*",
    "laracasts/commander": "~1.0",
    "laracasts/validation": "~1.0",
    "laracasts/presenter": "0.1.*"
},
"require-dev": {
    "way/generators": "~2.0"
},

此代码的参考和更多详情Reference

答案 1 :(得分:0)

启用你的php ext-zip lib。用

安装 php版本7的

sudo apt-get install php7.0-zip

答案 2 :(得分:0)

正如错误中已明确描述的那样,您缺少php-zip扩展名:

  

问题1            - laravel / installer v1.4.1需要ext-zip * - >您系统中缺少所请求的PHP扩展zip。

尝试使用此命令安装它(使用sudo):

apt-get install php-zip

它将自动为PHP7安装它作为Ubuntu存储库中PHP的默认版本。

PS:如果您已经安装了php-zip但仍然无效,请将扩展程序添加到php.ini中的/etc/php文件中,您就可以了。