Installing Laravel 4.1 in Windows 7 // Make .phar file globally available to windows command line

前端 未结 3 1948
感动是毒
感动是毒 2020-12-13 05:25

i have some problems installing Laravel 4.1 in Windows 7 via the first method explained in the Laravel documentation ( http://laravel.com/docs/installation#install-laravel )

3条回答
  •  鱼传尺愫
    2020-12-13 06:01

    The documentation on the Laravel website is not a good way to install laravel on windows. You'll got problem with the routing later.

    Accessing laravel URL like this is a no-no:

    http://localhost/new_project/laravel/public/
    

    to get a better URL you must setup Apache Virtual Host and edit hosts file.

    The best way to install Laravel on windows is to use Git and Composer. if you already successfully install Git and Composer, open Git bash and using ls and cd terminal command go to c:\xampp\htdocs folder

    Bash LS and CD

    and run this command (it will ask you for your Git passphrase, make sure you install your Git properly - tutorial here - http://www.thegeekstuff.com/2012/02/git-for-windows/):

    git clone git@github.com:laravel/laravel.git laraveldev
    

    It will download laravel into a folder name laraveldev in htdocs:

    c:\xampp\htdocs\laraveldev
    

    Use the Git bash terminal to install laravel into PHP using this command:

    composer install
    

    edit hosts file - located in c:\windows\system32\drivers\etc, add this:

    127.0.0.1 www.laravel.dev

    and put virtual hosts entry in c:\xampp\apache\conf\extra\httpd-vhosts.conf.

    
        DocumentRoot "C:/xampp/htdocs/laraveldev/public"
        ServerName www.laravel.dev
        ServerAlias www.laravel.dev
        ErrorLog "logs/laravel.log"
        CustomLog "logs/custom.laravel.log" combined
        
            AllowOverride All
            Order Allow,Deny
            Allow from all
            Require all granted
        
    
    

    Restart you xampp apache. Then you can access laravel app in your browser like this:

    http://www.laravel.dev

    I'm totally 100% sure you'll got those "You have arrived" text :D

提交回复
热议问题