Unable to execute the laravel command "laravel new myapp"

Getting this when I execute "$laravel new myapp

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

new [--dev] [--5.2] [--] [<name>]"
But to check if i had installed php i exexcuted this command too
"$ 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"

Please help me out ,I need to start working with laravel AS SOON AS POSSIBLE on my Ubuntu 16.04!

4 Answers

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

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

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

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

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

2

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like