6

Using Ubuntu 16.04. When I execute laravel new myapp, I am getting this:

[RuntimeException]                                                        
The Zip PHP extension is not installed. Please install it and try again.

new [--dev] [--5.2] [--] [<name>]

To check if I have php installed, I executed this command:

$ php -v
PHP 7.0.18-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.18-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies"
sotirov
  • 4,379
varun
  • 73

4 Answers4

14

Perhaps your missing a global install of laravel with composer:

Now run composer -version from a terminal, if you don't see a version printed out then start there. Install it using this link. If composer is there check if laravel is installed globally, run laravel -version from a terminal you should see something similar to this:

Laravel Installer version 1.3.3

Now if that doesn't appear then it's not installed, install using:

composer global require "laravel/installer"

Now add composer to your system PATH so you can run laravel command. Open your /home/$USER/.bashrc file and this line export PATH=$HOME/.composer/vendor/bin:$PATH to it.

Steps:

  1. Open .bashrc with nano:

     nano /home/$USER/.bashrc
    
  2. Add this line export PATH=$HOME/.composer/vendor/bin:$PATH.

    • UPDATE: On Ubuntu 18.04 the line should be export PATH=$HOME/.config/composer/vendor/bin:$PATH
  3. Source the file with source /home/$USER/.bashrc

Now run laravel -version from terminal to ensure all went well. At this point you can now run the laravel command to create applications.

Source:

Install laravel 5 on Ubuntu 16.04

https://laravel.com/docs/5.4#installing-laravel

UPDATE

Since your still seeing that error simply install that extension with:

sudo apt install php7.0-zip

Now run that laravel command again.

George Udosen
  • 37,534
2

For me it was enough to uninstall and reinstall like this:

composer global remove "laravel/installer"
composer global require "laravel/installer"
pomsky
  • 70,557
1

Install the missing extension with: sudo apt-get install php7.0-zip

michal
  • 226
0

Ok, I have the same problem and a quick solution could be use composer (if you already have it installed). So, check for composer installation:

composer -V

and use this command to create a laravel project:

sudo composer create-project laravel/laravel my-prpject-name --prefer-dist
J.C. Gras
  • 101