Getting Started with Laravel



For Laravel there are some installation guides around which tell you to install PHP first, but that’s not necessary with Cloud9.

Just make a new workspace, choose PHP, go to the Terminal, and execute the following (you can copy and paste all the commands into the console - they will be executed correctly):

rm php.ini hello-world.php
sudo composer self-update
composer create-project laravel/laravel ./laravel --prefer-dist
shopt -s dotglob
mv laravel/* ./
rm -rf laravel

As Lavarel is serving its content from the public directory we need to modify the apache config using nano (a text editor):

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

Then do the following:

// Change this line
DocumentRoot /home/ubuntu/workspace

// To following
DocumentRoot /home/ubuntu/workspace/public

To save the file press F2, then ‘Y’ and ‘Enter’.

Get the latest version of Laravel (i.e. 5.0.23 on the 29th March, 2015)

sudo composer update

Next you need to setup your database to work with Laravel - to do this, you first need to know the hostname, username and database name. The “mysql-ctl cli” command will give you these details

mysql-ctl cli
use c9;
select @@hostname;

Edit the Laravel environment configuration file “.env” (in the root directory) and add the database settings


Run the project with the “Run Project” button in the menu bar on top of the IDE. If you click the URL that appears in the Run panel below (in the shape of ‘’), you can preview your new Laravel app and you’re on your way.

Related resources:

How to run Laravel?
403 with laravel install
Tutorials - Table of Contents
Problem with laravel

Looks like the DB_PASSWORD field with blank doesn’t work. And for the DB_HOST => localhost works just fine. You may want update that.


My config is like:


Works fine without a password but do have to use localhost instead of the actual hostname.


@silentcoast @kabinpokhrel good notes. I’ve changed the post to include localhost and I ran through it to make sure it works as well. Should be good now :thumbsup:

PS I also removed the bit about a compiler error since it looks like that bug has been fixed but it’s always in the post history in case it needs to come back.


You may follow the installation guide of Laravel 5.2 the latest version.


i follow above example but have no luck. .env file is gone and run could not be click. Any help…
I tried also .env file manually but i wont allow me add…


Can you try showing hidden files and see if that helps?


Thanks for this terrific tutorial! This is a tremendous help!!!

Question: Do any of these settings affect how your project is exported when you go to move your app to a live server? Or can you package everything, “as is” and move it right over? In other words, what do I need to change after I transfer my files?

Thanks so much!!


Most likely you’ll need to change the database settings, unless you have a database named c9 :smile: But if you want to keep those database settings then you may be fine, it just depends how things are configured on your server.


You can see this video. it’s very easy to find .env file and editing


You may also open the workspace panel settings (gearwheel in the top right of that panel) and then choose to show hidden files. Then your .env file will show in the files panel.


I cannot find php.ini ’ Laravel 5.2 ’ in cloud9 , i wanna change max file upload


Have a look at Customizing php.ini


New instructions for Laravel 5.3 at: Laravel 5.3 Installation on Cloud9
Thanks @luciendub. I would never have gotten started with Laravel on C9 if it wasn’t for your post!


hey guys, just for any newbies here (will save you loads of time and frustration), this is what I found out after I couldn’t figure out why I am getting this error

SQLSTATE[HY000] [1045] Access denied for user ‘USERNAME’@‘localhost’ (using password: NO)

DB_USERNAME=USERNAME (this must be your cloud9 username, not just ‘USERNAME’)


I encounter an error

bash: line 1: play/.env: No such file or directory

Play is my folder name: workspace > play

I had configure my .env file

drwxr-xr-x 11 ubuntu ubuntu 4096 Nov 25 16:55 ./
drwxrwxr-x 4 ubuntu ubuntu 4096 Nov 25 17:07 …/
-rw-r–r-- 1 ubuntu ubuntu 479 Nov 25 16:56 .env
-rw-r–r-- 1 ubuntu ubuntu 485 Nov 25 16:54 .env.example
-rw-r–r-- 1 ubuntu ubuntu 61 Nov 25 16:35 .gitattributes
-rw-r–r-- 1 ubuntu ubuntu 95 Nov 25 16:35 .gitignore
… and more


Issue solve.

  • The problem is when I try to install php7 before install laravel 5.3. I did not install completely the package that the framework required.

  • Result the “Vendor” folder did not appear. Even I try so many time of “composer update”. It still did not appear until I found there is a error in the command prompt

Your requirements could not be resolved to an installable set of packages.

I found an the solution here Laravel 5.3 Installation on Cloud9

  • By reinstall back all the packages of php7.

After that enter the follow command

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

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

DocumentRoot /home/ubuntu/workspace/FOLDERNAME/public

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


You’re very welcome!



I followed the tutorial and I continued to get “No application seems to be running here!” error.
Do I have to run “php artisan serve” or Apache is the one that should handle the requests?


Did you also try following the guide that @prenna made?