This article describes how to get Laravel up and running in a Ubuntu Xenial Xerus development environment.
Minimum requirements for Laravel:
- PHP >= 5.6.4
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- Tokenizer PHP Extension
These notes describe installing Laravel on PHP 7 with MariaDB and Apache.
Use Composer to download the Laravel installer. It will then be available globally:
This will place the installer in
~/.composer/vendor/laravel/installer/, symlinked in
This latter directory shoudl be in your
$PATH so that the
laravel installer can be located by the system. You may need to add the follwoing to your
The Laravel installer calls the
Symfony\Component\Console\Application class to work it’s magic.
The development site will be located in the Apache docroot - and the installer will install Laravel in the current directory:
http://localhost/project-name/ in a browser will display the app directory structure.
Assuming the Apache user is
www-data, the following ownership settings need to be applied:
The Public Directory
The front controller for Laravel is
public/index.php file - this is the file that all requests hit. The
public directory will be the document root for the project.
If you’ve set permissions correctly, you should be able to access the new app:
It’s abit cumbersome to use this URL in the development environment. You should instead configure a virtual host directive for a suitable URL, and adjust your
/etc/hosts file so that your chosen domain directs to 127.0.0.1 (localhost).
Localhost and the Trailing Slash
There is a “gotcha” if you decide to devlop locally under Apache localhost - adding a trailing slash to the URL
http://localhost/your-app/page/ triggers Laravel to redirect to a non-trailing slashed home URL, which will be
http://localhost/page rather than
This can be worked around (maybe by means of
.htaccess rules) - but it’s probably easier all round to just set up a local Apache virtual host config and amend
etc/hosts to point to your localhost for a specified domain.
Post Install Checks
Check the 32 character application key in
.env has been set to a random string.
comments powered by Disqus