Articles

How to Install Laravel

Laravel is a free and open-source PHP framework. This tutorial will show you how to create a new Laravel 5 app on your server.

Creating an App in ServerPilot

First, click + Create App in ServerPilot; this can be done immediately after connecting a server or by going to the Apps page.

If you want to deploy Laravel under a system user other than serverpilot, you must have first set up your new system user.

Replace all instances of the serverpilot system user in this tutorial with the one you just created.

Give your app a name and select the runtime you would like to use.

You must select PHP 5.5, 5.6, or 7.0 for the runtime. Laravel 5.2 does not support PHP 5.4.

Next, select your app's server and the system user to run this app.

Click Create App to submit the form. You'll be shown some details about the app.

Installing the Laravel Framework

Now, it's time to install the Laravel framework in your new app.

SSH in to your server as serverpilot and run the following commands (where APPNAME is the name of your app):

cd apps
rm APPNAME/public/index.php
rmdir APPNAME/public
composer5.6-sp create-project --prefer-dist laravel/laravel APPNAME

This final command will take several minutes to complete. You should see many packages download and install.

If you are asked "Do you want to remove the existing VCS (.git, .svn..) history?", press Y.

You now have a fresh Laravel 5 application ready for development.