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 README.md 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; exit
Edit the Laravel environment configuration file “.env” (in the root directory) and add the database settings
DB_HOST=localhost DB_DATABASE=c9 DB_USERNAME=USERNAME DB_PASSWORD=
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 ‘https://laravel-c9-username.c9.io/’), you can preview your new Laravel app and you’re on your way.