简体   繁体   English

在Ubuntu中安装laravel时出错

[英]getting error while installing laravel in ubuntu

I have PHP version: 我有PHP版本:

php -v
PHP 7.1.9-1

composer version: 作曲者版本:

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

Now I am getting this error and I could not be able to solve this because I am new to this technology. 现在,我遇到了这个错误,由于我是这项技术的新手,所以我无法解决它。

 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.

If anyone knows what's the issue, please help me with this! 如果有人知道是什么问题,请帮助我!

Thanks in advance! 提前致谢!

Edit the composer.json file and replace with this 编辑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 of this code and more details Reference 此代码的参考以及更多详细信息

Enable your php ext-zip lib. 启用您的php ext-zip lib。 install it with 用安装

sudo apt-get install php7.0-zip for php version 7 sudo apt-get install php7.0-zip为php版本7 sudo apt-get install php7.0-zip

As it has been clearly described in the error, you are missing php-zip extension: 正如错误中已明确描述的那样,您缺少php-zip扩展名:

Problem 1 - laravel/installer v1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system. 问题1-laravel / installer v1.4.1需要ext-zip *->系统中缺少所请求的PHP扩展zip。

Try installing it using this command (use sudo ): 尝试使用以下命令安装它(使用sudo ):

apt-get install php-zip

It will install it for PHP7 automatically as its the default version for PHP in Ubuntu repositories. 它将自动将其安装为PHP7,作为Ubuntu存储库中PHP的默认版本。

PS: If you have php-zip already installed and it still does not work, add the extension to your php.ini files in: /etc/php and you are good to go. PS:如果您已经安装了php-zip,但是仍然无法正常工作,请将扩展名添加到/etc/php php.ini文件中,您就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM