简体   繁体   中英

getting error while installing laravel in ubuntu

I have PHP version:

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

"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. install it with

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

As it has been clearly described in the error, you are missing php-zip extension:

Problem 1 - laravel/installer v1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.

Try installing it using this command (use sudo ):

apt-get install php-zip

It will install it for PHP7 automatically as its the default version for PHP in Ubuntu repositories.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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