Skip to content

Instantly share code, notes, and snippets.

@nakamuraagatha
Last active March 12, 2018 12:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nakamuraagatha/56a83dac5ee25901278594b3f5e27eca to your computer and use it in GitHub Desktop.
Save nakamuraagatha/56a83dac5ee25901278594b3f5e27eca to your computer and use it in GitHub Desktop.
Install Laravel C9.io php 7.1 with Laravel Horizon

Install with PHP 7.1

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.1
sudo a2dismod php5
sudo a2enmod php7.1
sudo apt-get install php7.1-dom php7.1-mbstring php7.1-zip php7.1-gd php7.1-xml php7.1-gmp php7.1-mysql php7.1-sqlite php7.1-mcrypt php7.1-curl
sudo apt-get install php7.1-mysql
sudo apt-get install php7.1-sqlite

Laravel Global

sudo composer global require 'laravel/installer'
export PATH=~/.composer/vendor/bin:$PATH
laravel new laravel

After Update Composer please Change

sudo chown -R $USER $HOME/.composer

Apache Setting

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

Thanks to @AidHamza for correctly

<VirtualHost *:8080>
    DocumentRoot /home/ubuntu/workspace/public
    ServerName https://${C9_HOSTNAME}:443

    LogLevel info

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /home/ubuntu/workspace>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

ServerName https://${C9_HOSTNAME}
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Create Database

Login to Mysql :

mysql-ctl cli

Then

CREATE DATABASE laravel DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON laravel.* TO 'laraveluser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

You Got Error on php artisan migrate?

Please edit AppServiceProvider.php on app/Providers

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}

Want Deploy to Cloud Server?

Using this link : https://m.do.co/c/70b5b463c03f

@AidHamza
Copy link

Thanks @nakamuraagatha, In Apache vhost /etc/apache2/sites-enabled/001-cloud9.conf we need to point to Laravel public dir or rely on .htaccess

<VirtualHost *:8080>
    DocumentRoot /home/ubuntu/workspace/public
    ServerName https://${C9_HOSTNAME}:443

    LogLevel info

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /home/ubuntu/workspace>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

ServerName https://${C9_HOSTNAME}
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment