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.
Mysql
Enter the following commands:
mysql-ctl cli
use c9;
exit;
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.
Sqlite
- 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