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"

4 Answers 4

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.

10
  • Having done all that ,in my chrome i ran this URL localhost/laravel52/public/ and I'm able to see the laravel home page .But still I'm not able to run the laravel new appname command as I am getting the same error .
    – varun
    Jun 15, 2017 at 11:11
  • Having done all that ,in my chrome i ran this URL localhost/laravel52/public/ and I'm able to see the laravel home page .
    – varun
    Jun 15, 2017 at 11:11
  • Did you install all the requirement for laravel to work as suggested on that first link? Jun 15, 2017 at 11:22
  • Laravel Installer 1.3.3 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.
    – varun
    Jun 15, 2017 at 13:28
  • Ok that means its there I had an error in my syntax, it should have been laravel --version so install that extension and give us the good news Jun 15, 2017 at 13:52
2

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

composer global remove "laravel/installer"
composer global require "laravel/installer"
1

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

2
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
    – Stormvirux
    Jun 13, 2017 at 19:39
  • 1
    @Stormvirux: Author pasted exception stating his PHP install is missing zip extension. The suggested solution is to install it.
    – michal
    Jun 13, 2017 at 19:55
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .