How to install Lavarel? 如何安装Lavarel
中英切换太麻烦了…
- install php
- config php :
rename the php.ini-deveplopment => php.ini
- enable the extension in php.ini
extension=php_mbstring.dll
extension=php_openssl.dll
- add php to $path
- config php :
install composer;
run the command like these:
- php -r “copy(‘https://install.phpcomposer.com/installer‘, ‘composer-setup.php’);”
- php composer-setup.php
- php -r “unlink(‘composer-setup.php’);”
Thanks: https://pkg.phpcomposer.com/#how-to-install-composer
you will get file
composer.phar
,and then thephp composer.phar
is just composer; !!look—>:php composer.phar -v .... Some Version description ...
To just use the name of “composer” ,add “composer.phar” to php dir;
- add file “composer.bat” at php dir ( where there is php.exe);
- write in “composer.bat” ” :
@php "%~dp0composer.phar" %*
install Lavarel :
- global install :
composer global require "laravel/installer"
- 配置环境变量:
$YouInstallHome/vendor/bin
( where there is laravel.bat) add to $path; - create Lavarel project :
laravel new blog
- cd to blog ,and install dependence(use
composer.json
):
composer install
- use
artisan
to init awsome works (you will find file “artisan” aftercomposer install
) :
php artisan optimize
- global install :
- create Laravel config file “.env”
- create new file “.env” from “.env-example”
config for apache
- enable the Module rewrite for file ‘.htaccess’
LoadModule rewrite_module modules/mod_rewrite.so
- set access to /
<Directory/>
AllowOverride all
Require all granted
</Directory>
- set “index.php” as DirectoryIndex:
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
- enable the Module rewrite for file ‘.htaccess’
enable Laravel debug:
- open “config/app.php”, set debug from ‘false’ to ‘true’; That’s an amazing debugger!;
'debug' => env('APP_DEBUG', true),
- open “config/app.php”, set debug from ‘false’ to ‘true’; That’s an amazing debugger!;
success Page: