5

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!

Ravexina
  • 54,268
  • 25
  • 157
  • 179
varun
  • 63
  • 1
  • 1
  • 6

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
  • 35,970
  • 13
  • 99
  • 121
  • 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 '17 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 '17 at 11:11
  • Did you install all the requirement for laravel to work as suggested on that first link? – George Udosen Jun 15 '17 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 '17 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 – George Udosen Jun 15 '17 at 13:52
  • It's showing Laravel 1.3.3 – varun Jun 15 '17 at 14:08
  • Now install that extension and run the code to create a new laravel app – George Udosen Jun 15 '17 at 14:09
  • Thank you so much GEORGE!!!! It worked after spending quite some time – varun Jun 15 '17 at 14:30
  • Accept is the tick(✅) mark? – varun Jun 15 '17 at 15:13
  • Yes, and the `^` is to upvote an answer you like – George Udosen Jun 15 '17 at 15:19
2

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

composer global remove "laravel/installer"
composer global require "laravel/installer"
pomsky
  • 67,112
  • 21
  • 233
  • 243
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
  • 1
0

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

michal
  • 216
  • 3
  • 8
  • 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](/review/low-quality-posts/721688) – Stormvirux Jun 13 '17 at 19:39
  • @Stormvirux: Author pasted exception stating his PHP install is missing zip extension. The suggested solution is to install it. – michal Jun 13 '17 at 19:55