ubuntu16.04 Installation composer and Laravel

Source: Internet
Author: User
Tags install php
I. Installation of composer

$ sudo apt-get update

$ sudo apt-get install wget

Download Composer.phar
$ wget Https://getcomposer.org/composer.phar
or $ Curl-o Https://getcomposer.org/composer.phar

Rename file Composer.phar to composer
$ mv Composer.phar composer

$ chmod +x composer can now run composer through the./composer command, but this is only limited to running in the current directory. To use the global, composer, set it as a global variable. Locate the composer file and move it to the/usl/local/bin directory so that you can use the composer command globally.
$ sudo mv Composer/usr/local/bin
In the terminal input $ composer will have the following display indicating that the installation was successful

Composer version 1.4-dev (d8d0ee5870010253c98a7db4d27b07cd17bd6617) 2017-01-13 09:34:43 Usage

:
  command [ Options] [arguments]

options:-
  H,--help Display this help message
  -Q,--quiet don't                    output any Message
  -V,--version                  Display This application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI Output
  -N,--no-interaction do don't ask any           interactive question
      --profile    
  ............
  ............ Wait a minute
second, the use of Composer installation Laravel

To download the Laravel installation package using Composer:
Composer global require "Laravel/installer"

Make sure that the PATH environment variable has been added to the Composer/vendor/bin directory so that the executable laravel can be detected by your system. With the above installation composer, the composer directory that I want to add locally is:
/home/yan/.config/composer/vendor/bin
So I added this bin directory to the/etc/profile and ~/.BASHRC files:
Export Path=/home/yan/.config/composer/vendor/bin: $PATH
Perform source/etc/profile and source ~/.BASHRC to make the environment effective immediately

Once the installation is complete, the terminal $ laravel-v can be
You can use the Laravel new command to create a newly installed Laravel application in the directory you specify. For example: the laravel new Blog command will create a directory named blog in the current directory, which contains the newly installed Laravel, and all dependent packages have been installed. This method can be installed much faster than through a Composer installation. third, the error solution

The system environment is: PHP 7.0.13-0 + ubuntu0.16.04.1 (CLI)
1. Failure to create a new project with Laravel My_app error

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

Workaround install sudo apt-get install Php7.0-zip
2. Laravel/framework v5.2.18 requires ext-mbstring *-> The requested PHP extension mbstring is missing from your syste M.
Workaround execution sudo apt-get install php7.0-mbstring
You do not need to change the php.ini file.

3.phpunit/phpunit 4.0.2 requires Ext-dom *-> The requested PHP extension DOM is missing from your system.
Workaround execution sudo apt-get install Php-xml

4.pdoexception:could not find driver
Workaround execution sudo apt-get-y install Php-mysql

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.