← Back to the Blog

Installing Laravel 4 on Plesk 12

By Matthew Setter
Installing Laravel 4 on Plesk 12

Plesk 12 comes with a range of pre-built installation wizards for a number of the most popular PHP CMS’ on the market, such as Wordpress, Drupal and Joomla, but not for the major PHP frameworks, such as Zend Framework 2, Laravel, FuelPHP and Symfony.

This is a little unfortunate, but it’s no deal breaker; and to be fair, as they’re frameworks, not complete applications, it makes sense. Given the flexibility of Plesk 12, as administrators, developers and devops, we’re able to do take care of all the necessary steps manually.

In today’s tutorial, I’m taking you through how to set up and deploy a basic Laravel 4 application on Plesk 12. By the time we’re done, you’ll see the site, as in the screenshot below.

Laravel on Plesk 12

Before we get started though, I should say that it won’t be a shining example of a world-beating application, but it will have the core Laravel 4 framework installed, ready and configured with a connection to a MySQL backend database. So if you’re keen to step further, you’re in the best position to do so.

What Is Laravel

Before we dive in to the setup, what is Laravel? Laravel is one of the newer PHP frameworks, dubbed as “The PHP Framework For Web Artisans.”

First released by Taylor Otwell on the 22nd February, 2012, it’s risen rapidly to become the most popular open-source, PHP, project on GitHub.

Dubbed as being great for both beginners and more experienced developers, Laravel comes packed with features, including RESTful routing, fast and efficient templating, a feature-rich ORM layer andmigrations support.

What’s more, the community is extremely active and has created a number of tools, such as Laravel Homestead and Laravel Forge which make going from development to production almost trivial.


To complete today’s tutorial, you’re only going to need one prerequisite, which is:

  • Admin access to Plesk
  • Plesk System User with ssh access (if not, we create one in this article)
  • The server must have mcrypt installed

Getting Setup

Right, so what do we need to do to set it up? Thanks to the modern UI, and intelligent layout available in Plesk 12, it’s a real no brainer, requiring only a few steps to have it live; which are as follows:

  • Create a Sub-Domain
  • Setup SSH Access
  • Create The Database
  • Install Composer
  • Install Laravel
  • Configure Laravel
  • View The Application

Let’s work through the process now.

Create a Sub-Domain

When you first login to your account, click the Domains in the left-hand side navigation bar, under Hosting Services. To keep this simple, we’re going to create a new sub-domain, specifically under conetix.com.

On the far right of that domain’s row in the table, click “Manage Hosting“. This will display the domain and sub-domain entries, which you can see in the screenshot below.

Domain Manage Hosting Plesk 12 Screenshot Laravel 4

Above the first entry, you’ll see three buttons: “Add New Domain“, “Add New Subdomain” and “Add New Domain Alias“. Click “Add New Subdomain”, and on the form which appears, enter “laravel” for the subdomain name. The Document root field will be pre-populated, based on the Subdomain name you entered. But at the end, add in “/laravel/public”.

The reason for this is that the command we’ll run to install Laravel creates a sub-directory, called laravel, and the application’s bootstrap file is located in the public directory beneath that. 

When it’s finished you’ll be back on the domains page you started at, with your new domain available at the bottom of the list. In the entry, you’ll see all the pertinent details, along with links to more, as well as to make changes.

Setup SSH Access

Now we need to check that SSH access is setup properly, so that we can login and run a few command line scripts. If you’re not too familiar with command line scripts, that’s ok. The one’s I’ve listed here are quite simple and have sufficient documentation, should it be needed.

Web Hosting Access Plesk 12 Laravel 4

At the bottom of the subdomain’s entry, click the tab titled “Show More“, then click the first entry in the exposed list, titled “Web Hosting Access“. On the page that appears, you’ll see four sections.

Configure SSH access Plesk12 Laravel

In the second section, titled “System user“, make sure that the last option, “Access to the server over SSH“, is set to /bin/bash or /bin/sh and click OK at the bottom.

The reason for this is because these scripts need that environment to run in. sh may work, but bash works best for this example. Now you’re ready to login and begin installing the application.

Note: if you’re not sure of the user’s password, either regenerate it or check with your systems administrator.

Create The Database

Now we have one last pre-install step to do, create a database. Back in the sub-domain settings, above the “Show Less” tab, on the right you’ll see a Databases option.

Next to it, click “Add New Database“, where you’ll be directed to create new database form, as in the screenshot below.

Create Database Plesk12 Screenshot Laravel 4

On that page, set “Database name” to “admin_laravel“, leave “Create a new database user” checked and set “Database user name“ to “laravel_user“. Set a secure password under "New Password/Confirm Password". Make a note of these details as you will need them later in the article. For “Access control“, choose the first option, “Allow local connections only“, then click OK.

You’ll then be redirected to the databases list, where you’ll see the new database last in the list (or the only one if this is the first). Feel free to inspect it if you like, but there’s no need to to complete this tutorial.

Install Composer

Composer Homepage Plesk12 Screenshot Laravel 4

Now we’re ready to begin installation of Laravel. To do so, we’re going to use Composer. If you’re not familiar with Composer, it’s a dependency manager for PHP.

In years gone by, many projects implemented common functionality, such as routing, database layers, caching interaction and logging on their own, making it difficult to port applications to newer or different frameworks, or for them to be maintained in a cost and time-effective.

Composer makes it almost painless for best of breed libraries for any specific purpose to be created, voted on, discovered and most importantly used in applications.

To find out more about it, I encourage you to read this introduction to it or a walk through of the Composer Cheatsheet I made for Sitepoint. You’ll be up and running with it in no time.

To install composer, login as the Plesk System User we created earlier and cd to ‘/var/www/vhosts/conetix.com/laravel.conetix.com’ substituting ‘conetix.com’ based on your domain setup; then run the command below:

curl -s https://getcomposer.org/installer | php --

This downloads Composer, piping it through to PHP, in the process creating a self-contained file we can use, called composer.phar.

Install Laravel

Now we need to install Laravel. From your current directory, run the command below:

php ./composer.phar create-project laravel/laravel --prefer-dist

This will install Laravel in the directory structure we covered earlier, displaying output similar to that below.

Installing laravel/laravel (v4.2.0)
   - Installing laravel/laravel (v4.2.0)
     Loading from cache 
Created project in
Loading composer repositories with package information
Installing dependencies (including require-dev)
   - Installing symfony/debug (v2.5.2)
   Downloading: 100% 
   - Installing symfony/http-foundation (v2.5.2)
   Downloading: 100% 
   - Installing swiftmailer/swiftmailer (v5.2.1)
   Downloading: 100% 
   - Installing laravel/framework (v4.2.7)
   Downloading: 100%

Configure Laravel

Assuming that there are no errors, timeouts or permission issues, now we need to configure the setup. So cd to laravel the new directory and using vim or your editor of choice edit app/config/app.php. In the file, set the following options:

Setting Option
debug true
url ‘http://laravel.conetix.com’

Save the changes, then edit app/config/database.php and find the section marked ‘connections’ and make sure the settings are as below for the mysql sub-option (these are the same details used when setting up the database earlier):

Setting Option
host ‘localhost’
database ‘admin_laravel’
username ‘laravel_user’

For the password, insert your generated password. Saving that, you’re now ready to run the default, Laravel, application.

4. View The Application

Let’s have a look at the running app. It’s not special, as there’s no new controllers or actions beyond the default; it’s just a one page application, but it works.

Laravel on Plesk 12

Wrapping Up

In just a few minutes, we’ve stepped through creating and configuring a sub-domain, to installing a sample application, based on the Laravel framework.

Now it’d be great if it was simpler, such as having an installer for Drupal, Joomla and Wordpress. But it’s a bit hard to compare off the shelf applications, such as these, to frameworks which allow for creating nearly any kind of application.

What I’m hoping for is to have an installer which lays the foundation for this process, which may just be available in the future.

Till then, share your thoughts in the comments. Has this made it simpler for you to start creating applications with Laravel on Plesk? I hope so. I’d love to hear how you feel.