How to install Laravel (v5.5.0) on Cloud 9 and run Dusk

■Cloud9
https://c9.io/

(1) Create workspace
Create workspace in Blank
Delete README.md

(2) Installation of 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-mysql php7.1-sqlite
service apache2 restart

(3) Installation of Laravel (v5.5.0)

sudo composer self-update
sudo composer create-project --prefer-dist laravel/laravel ./laravel
shopt -s dotglob
sudo chown ubuntu:ubuntu * -hR
mv laravel/* ./
rm -rf laravel

(4) Apache setup

sudo vim /etc/apache2/sites-enabled/001-cloud9.conf
DocumentRoot /home/ubuntu/workspace
↓
DocumentRoot /home/ubuntu/workspace/backend/public
sudo composer update

(5) Installation of Laravel Dusk

composer require --dev laravel/dusk
php artisan dusk:install

(6) Modifying .env
APP_URL=http://127.0.0.1:8000

(7) Error countermeasure 01

[problem]
php artisan serve & php artisan dusk

When you execute, at this point,

Error: Call to undefined function Facebook \ WebDriver \ Remote \curl_init ()

Will come out.

[Cause]
Because Facebook \ WebDriver version is old (v1.1.1).

[Countermeasure]
Change the version of Facebook \ WebDriver to the latest (v1.4.1).

■Packagist – facebook/webdriver
https://packagist.org/packages/facebook/webdriver#1.4.1

(i) install curl
Since 1.1.2, ext-curl: * has been added to requires,
Install curl.

sudo apt-get install php7.1-curl

(ii)composer update

composer update

It went up to v1.4.1.

(8) Error countermeasure 02

[problem]
php artisan serve & php artisan dusk

When you run it, this time

Facebook \ WebDriver \ Exception \ UnknownServerException: unknown error: can not find Chrome binary

Will come out.

[Cause]
I can not find a chrome binary.

[Countermeasure]
Install chrome.

sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & php artisan serve & php artisan dusk

And, success! !

Once you run it, the process of Chrome and artisan serve will continue, so from next time,

php artisan dusk

Just it is executable.

Leave a Reply

Your email address will not be published. Required fields are marked *