Laravel 5.3 Installation on Cloud9



Laravel 5.3 Installation on Cloud9

First - create a new PHP workspace.

Upgrade PHP from 5.5 to 5.6

Enter the following commands into the terminal one at a time:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php5.6
sudo a2dismod php5
sudo a2enmod php5.6
sudo add-apt-repository ppa:ondrej/php5-compat
sudo apt-get update
sudo apt-get dist-upgrade

These commands get the files necessary to upgrade the PHP version and then make sure that apache loads the correct configuration files when you start your application server.

PHP 7.0

If you want to use PHP7, instead of the commands above, do:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.0
sudo a2dismod php5
sudo a2enmod php7.0
sudo apt-get install php7.0-dom
sudo apt-get install php7.0-mbstring
sudo apt-get install php7.0-zip

You will also need to install the mysql or sqlite driver to use either.

sudo apt-get install php7.0-mysql
sudo apt-get install php7.0-sqlite

Laravel worked first time for me without any issues with these. There may be other modules that laravel requires, but dom, mbstring, and zip are the ones it shouts at you during installation if you forget them.

Install Laravel 5.3

Again, copy the following commands (this time you can copy them all at once) into the terminal, and press return for the last command:

sudo composer global require 'laravel/installer'
export PATH=~/.composer/vendor/bin:$PATH
laravel new laravel
  • Move the files and folders from the laravel folder to you workspace folder.
  • Remove the empty laravel folder.

Now enter the following command to edit the file that tells apache to start your app/site from the public folder:

sudo nano /etc/apache2/sites-enabled/001-cloud9.conf

and add /public to the end of line 2 e.g.

DocumentRoot /home/ubuntu/workspace/public

Press F2 or Ctrl/Cmd + X to exit, then y and return to save.

“et voila” your app is ready!

Set up your database.


Enter the following commands:

mysql-ctl cli
use c9;

Add the database details to your .env file.

  • the database name is c9
  • the username is the same as your c9 username
  • leave the password blank

If you want to be able to look at your database using phpmyadmin do:

phpmyadmin-ctl install

Follow the instructions in the terminal to access it. (Basically your app domain /phpmyadmin - it won’t load the first time, you’ll need to remove :80 from the url and press return again.) Again, the username is your c9 username, and the password is blank.


  • Go to config/database.php and change the default to sqlite.
  • Add a new file called database.sqlite to the database folder.

Add authentication routes to your app.

Enter the following into the terminal:

php artisan make:auth
php artisan migrate

Now ‘Run Project’, load your app’s url, register and you’re done!

##Update NPM and node

NPM and Node need upgrading so that gulp and elixir work properly. Just enter the following commands after the rest of your installation, then the gulp command should work fine.

sudo npm install -g n
sudo n latest
sudo npm install -g npm
npm inst

##Further Help

If anything goes wrong, don’t ask me, I’m a nOOb and it took me days to get all of these steps together! I’m JOKING! I’m happy to help and talk about Laravel anytime!

I encourage any suggestions to make these instructions clearer.

Question: Why don’t Cloud9 just let us clone other’s public workspaces? Then you could just clone my laravel workspace and be done in 10 secs instead of 5 mins!

Guide to Laravel 5.4 Workspace Installation
How to install Laravel 5.3 to a workspace?
Getting Started with Laravel
How to upgrade to PHP7
Getting Started with Laravel
Getting Started with Laravel

i get this error when
php artisan migrate

sqlstate hy000 1045 access denied for user forge @ localhost using password no

any idea how can i fix this??

Thanks for your post


Have you actually created a database called ‘forge’ with user ‘forge’?

The default for every php workspace the database name is ‘c9’ and the username is ‘your_c9_username’ - in your case this is ‘donbarbas’.

So your config/database.php should look like this for mysql:

    'database' => 'c9',
    'username' => 'donbarbas',
    'password' => '',

Why have you removed the .env file? You will have other problems after fixing this database issue.
You should leave the default in config/database.php and enter the details in .env in case you share to github or otherwise.


Erro :triumph:
Started apache2
AH00112: Warning: DocumentRoot [/home/ubuntu/workspace/public] does not exist
/mnt/shared/bin/run-apache2: line 70: 57596 Segmentation fault apache2


I can’t believe that I’m actually saying this because nothing ever works smoothly for me. That being said, your solution worked like a charm for me. Amazing! Thank you so much for sharing your time and knowledge with us. Much appreciated. Peter


@peterbata You’re welcome. It took me ages to work this out. Good to know it’s helpful.

I’ve been getting lots of practice in lately using Vue.js, and Firebase (with vuefire to link Vue and Firebase) for doing real-time database stuff (instead of using with laravel) and using firebase authentication to set up sign in with multiple auth providers because again it’s even simpler than setting up socialite with laravel. But I still use the Laravel 5.3 installation to start as it saves all the effort of installing and configuring webpack and Vue manually.

Hit me up if you wanna chat about the other starter workspaces I’ve been working on.


Thanks again prenna. Sounds like you have been at this stuff a while and have a much deeper understanding of the various frameworks. As for me, my journey is just beginning. By the way, which starter workspaces are you referring to? Have a great weekend. Peter


Actually I’m still pretty new to this stuff too. I started learning to use laravel without any knowledge of php or javascript. I wanted to start finding out how to make simple web applications that people could log into. Authentication and server side programming requires a lot of skill without a framework. I figured out how to install laravel because fiddling with local development again requires lots of computer knowledge that isnt standard. Installing on cloud9 means you can create a fresh working install that you can just clone every time you want to try something new.

I’m refering to my own customised starter apps, some with modified routes and authentication flows. I’ve also started using Firebase in conjunction with vue in the last couple of weeks to try some different authentication methods and realtime database stuff. If you want to start working on something very new that will change the way we use the web check out google’s videos and documentation on progressive web apps, polymer and firebase.

What kind of things are you working on?


Actually, I am not working on any project per say. When I can, I try to take in some YouTube multi-part tutorials on Laravel. To be honest with you, I often feel guilty spending that much time trying (emphasis on “trying”) to learn something that doesn’t really bring home the bacon, so-to-speak. Not to mention that I have a difficult time retaining much of what I see and hear. But. I must admit that I do find it so intriguing. Fascinating, actually. I try to take in a few Laravel podcasts as well. Thanks for the google videos suggestions as well.


I would recommend laracasts for learning. Watch and work along with all of the free videos. Ive watched some of them 3 or 4 times because it is hard to remember almost anything until you’ve actually done it over and over for a while. Most paid developers probably still spend most of their time referring to documentation and discussing stuff on stack overflow. Only yesterday I was reading through the js pages on w3schools to learn what javascript is actually doing.


The retention thing must come with age I guess. I have visited the Laracast site on several occasions. Jefferey Way is amazing. When he talks about laravel and coding in general it’s akin to my speaking to my wife and kids in English. Blows my mind. I only wish that I could look at a snippet / chunk of code and in my mind, see exactly what the code is doing. Like reading a good novel. You can feel what the character is feeling. See what the character is seeing. I’m rambling on now. Sorry about that. Take care and happy coding / learning. Peter


When it was first released, you could drop laravel into an htdocs directory, fire up MAMP and you were coding.

I’ve literally been trying to get 5 running off and on for a year. (I’m not very smart and I get discouraged easily)

Your guide made it happen.

Thank you.


Thanks for the guide, Prenna!

This almost worked for me, except the .env file did not generate on install, nor did the .example.env file. So, I made myself a new .env file, and set APP_KEY=“and went nuts on the keyboard to make a random 32 bit string”.

Much more fun than using php artisan key:generate.

Also, if you’re reading this and you’re confusedasfuck.exe about this process, consider using Laravel 4. Works pretty well, and much easier to install. Just create a new c9 php workspace, and run:

composer create-project laravel/laravel=4.2.* project-name --prefer-dist

Replace project-name with the name of your project. 10/10, laravel 4 installed. Happy days.


Could I use some or all of the steps outlined here to install for example Laravel 5.2.0

Thank you. Have a great weekend everyone. And, Happy Thanksgiving to my neighbors to the south.


how do i create and .env file?? I installed laravel and there is no .env file…
i also tried to do “sudo nano .env” but there is no file…


You rock!!! Yes C9 letting us share workspaces would be awesome.


You could copy from the laravel github repository.
Then do
php artisan key:generate
to generate your app key so you don’t get any errors.


Whatever the standard installation instructions are for 5.2 should work with a standard php workspace. 5.2 does not need php5.6 or 7 so you can skip that bit.


Thank you Paul. Worked like a charm. Have a great day! Peter


Thanks for this tutorial, but when I run sudo a2dismod php5 has this error:
Could not parse /etc/apache2/envvars