Laravel 5 installation on Ubuntu 14.04: Difference between revisions

→‎Post-installation updates: add a note for Nginx users
→‎Post-installation updates: add a note for Nginx users
 
(7 intermediate revisions by 2 users not shown)
Line 28: Line 28:


Download Laravel installer using Composer.
Download Laravel installer using Composer.
<source lang="bash" highlight="1">
mhan@brahms:~$ composer global require "laravel/installer=~1.1"
Changed current directory to /home/mhan/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/process (v2.6.4)
    Down    Downloading: 100%
  - Installing symfony/console (v2.6.4)
    Down    Downloading: 100%
  - Installing guzzlehttp/streams (2.1.0)
    Down    Downloading: 100%
  - Installing guzzlehttp/guzzle (4.2.3)
    Down    Downloading: 100%
  - Installing laravel/installer (v1.2.0)
    Down    Downloading: 100%
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing psr/log (For using the console logger)
Writing lock file
Generating autoload files
</source>


<div class="cli">
<div class="cli">
Line 133: Line 106:
Update <span class="package">app.url</span>, <span class="package">app.timezone</span><ref name="timezone">''PHP Manual''. Program documentation. ''PHP Manual''. N.p., n.d. Web. 26 Feb 2015. <http://php.net/manual/en/timezones.php>.</ref>.
Update <span class="package">app.url</span>, <span class="package">app.timezone</span><ref name="timezone">''PHP Manual''. Program documentation. ''PHP Manual''. N.p., n.d. Web. 26 Feb 2015. <http://php.net/manual/en/timezones.php>.</ref>.


<source lang="php">
<syntaxhighlight lang="php">
<?php
<?php
// config/app.php
// config/app.php
Line 141: Line 114:
'timezone' => 'America/Denver',
'timezone' => 'America/Denver',
..
..
</source>
</syntaxhighlight>


It may be just fine to leave the timezone to UTC if you are going to be accommodate for user's particular timezone through some means. If the application isn't going to be serving users from different time zones and you don't plan to scale it then set it to your local one.
It may be just fine to leave the timezone to UTC if you are going to be accommodate for user's particular timezone through some means. If the application isn't going to be serving users from different time zones and you don't plan to scale it then set it to your local one.
Line 149: Line 122:
<div class="cli">
<div class="cli">
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span><span style="color:blue;">/srv/www/sanban</span><span style="color:#cccccc;">
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span><span style="color:blue;">/srv/www/sanban</span><span style="color:#cccccc;">
$ <b class="color:white;">sudo chown -R www-data:mhan storage</b>
$ <b class="color:white;">sudo chown -R www-data:www-data storage</b>
</span><br>
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span><span style="color:blue;">/srv/www/sanban</span><span style="color:#cccccc;">
$ <b class="color:white;">sudo chmod -R 0664 storage</b>
</span><br>
<span style="color:#00ff00;">mhan</span><span style="color:#444444;">@</span><span style="color:#00cccc;">brahms</span><span style="color:#999999">:</span><span style="color:blue;">/srv/www/sanban</span><span style="color:#cccccc;">
$ <b class="color:white;">sudo find storage -type d -exec chmod 2775 '{}' \;</b>
</span>
</span>
</div>
<div class="mw-geshi">
NOTE FOR NGINX USERS: I know this instruction was originally written for Apache web server, but if you're using Nginx and you happen to be using something else than Ubuntu, then you can replace the line that contains 'www-data' with the following:
$ sudo chown -R `grep user /etc/nginx/nginx.conf | sed 's/user //g; s/;//g'`:`grep user /etc/nginx/nginx.conf | sed 's/user //g; s/;//g'` storage
</div>
</div>


Line 178: Line 163:
If you use VIM like I do, you can insert this into your <span class="shell">~/.vimrc</span> file and just hit <code>,t</code> (comma and then t) key combination to run the unit test wherever you are under the project directory. This is a bit long because I have some repetitive bash commands to automatically detect the current application name and use that, i.d. "sanban" in this example.
If you use VIM like I do, you can insert this into your <span class="shell">~/.vimrc</span> file and just hit <code>,t</code> (comma and then t) key combination to run the unit test wherever you are under the project directory. This is a bit long because I have some repetitive bash commands to automatically detect the current application name and use that, i.d. "sanban" in this example.


<source lang="vim">
<syntaxhighlight lang="vim">
nmap ,t :!if [ -d .git ] \|\| git rev-parse --git-dir > /dev/null 2>&1; then phpunit.$(cat $(git rev-parse --show-toplevel)/phpspec.yml \| grep "namespace" \| awk '{print tolower(substr($0,20));exit}') -c $(git rev-parse --show-toplevel); else phpunit.$(cat $(git rev-parse --show-toplevel)/phpspec.yml \| grep "namespace" \| awk '{print tolower(substr($0,20));exit}'); fi<cr>
nmap ,t :!if [ -d .git ] \|\| git rev-parse --git-dir > /dev/null 2>&1; then phpunit.$(cat $(git rev-parse --show-toplevel)/phpspec.yml \| grep "namespace" \| awk '{print tolower(substr($0,20));exit}') -c $(git rev-parse --show-toplevel); else phpunit.$(cat $(git rev-parse --show-toplevel)/phpspec.yml \| grep "namespace" \| awk '{print tolower(substr($0,20));exit}'); fi<cr>
</source>
</syntaxhighlight>


In order for this to work properly your project directory has to be initialized as a git repository.
In order for this to work properly your project directory has to be initialized as a git repository.
Line 226: Line 211:
<div class="references-small"><references /></div>
<div class="references-small"><references /></div>


[[Category:Web development]]
[[Category:Web development]][[Category:Laravel]]