2014年9月24日 星期三

Laravel Installation in CentOS

1. Installl Composer Globally


https://getcomposer.org/doc/00-intro.md#downloading-the-composer-executable
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer


2. Install Laravel


* Required PHP 5.4
For upgrade PHP 5.3 to PHP 5.4

composer global require "laravel/installer=~1.1"


3. add ~/.composer/vendor/bin into $PATH



4. create a new laravel project which name is "test" in /var/www/html


cd /var/www/html
laravel new test


5. give  test/app/storage   write permission to apache




6. add a virtual host in httpd.conf

 
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html/test/public
    ServerName laravel.example.com
    ErrorLog logs/laravel-error_log
    CustomLog logs/laravel-access_log common
           
                AllowOverride All
           




 7. browse  http://localhost/


It should display "You have arrived."


8. edit config files

app/config/app.php
'debug' => true,   //for debug message
'timezone' => 'Asia/Taipei',  //for timezone to Taipei

app/config/database.php


9. add a sample router

edit   app/router.php

Route::get('time', function()
{
    return date("Y-m-d H:i:s");
});

browse http://localhost/time






沒有留言:

張貼留言