Laravel 安装

1.Install Composer:
  1.1 windows:
    cd C:\composer
    下载 https://getcomposer.org/installer
    php installer
	
    create composer.json:
    {
      "require": {
      }
    }
    
    php composer.phar install

    推荐直接下载安装包 Composer-Setup.exe 进行安装
  1.2 Linux:
    curl -sS https://getcomposer.org/installer | php
    chmod +x composer.phar
    mv composer.phar /usr/local/bin/composer

使用官方源有时需要开启VPN,可以使用国内镜像(镜像不完整,某些库会报404):
php composer.phar config -g repositories.packagist composer http://packagist.phpcomposer.com
或:
composer config -g repositories.packagist composer http://packagist.phpcomposer.com
2.Install Laravel:
  2.1 windows:
    cd xxx\webdoc\
    php c:\composer\composer.phar create-project laravel/laravel --prefer-dist
  2.2 Linux:
    cd /usr/share/nginx/html/
    composer create-project laravel/laravel --prefer-dist
    如果报错:Allowed memory size of 134217728 bytes exhausted... 则使用:
    php -dmemory_limit=256M /usr/local/bin/composer create-project laravel/laravel --prefer-dist
	
    chmod -R 755 laravel/
    chmod -R 777 laravel/storage/
    chmod -R 777 laravel/bootstrap/cache/
3.Web Server Setting:
  3.1 Nginx:
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
  3.2 Apache:
    Options +FollowSymLinks
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
4.Test Laravel:
http://localhost/

发表评论

电子邮件地址不会被公开。 必填项已用*标注