Install Laravel 5.5 at Codeanywhere with PHP 7.1 and MySQL 5.7

Update system

sudo apt-get update
sudo apt-get upgrade -y

Enter always ‘y’ if there are any overwrite questions. Next, install required software:

sudo apt-get install nano software-properties-common python3-software-properties -y

Remove PHP 5

sudo apt-get purge php5-common -y
sudo apt-get update
sudo apt-get autoremove -y

Install PHP 7.1

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1 php7.1-mysql php7.1-mbstring php7.1-zip php7.1-xml -y

Install Composer / Laravel

sudo composer self-update
sudo composer global require "laravel/installer"
echo 'export PATH=$PATH:$HOME/.composer/vendor/bin' >> ~/.bashrc
source ~/.bashrc

Create new Laravel app

laravel new myapp

Configure Apache

Change DocumentRoot

sudo nano /etc/apache2/sites-available/000-default.conf

to

DocumentRoot /home/cabox/workspace/myapp/public

Restart Apache:

sudo apache2ctl restart

Set Permissions

cd ~/workspace/myapp
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

Install and Configure MySQL 5.7

Download MySQL

cd ~/workspace/
wget https://dev.mysql.com/get/mysql-apt-config_0.8.9-1_all.deb

Run

sudo dpkg -i mysql-apt-config_0.8.9-1_all.deb

Select MySQL Server 5.7 to install (Press 1, 2 then 4, always followed by ‘enter’). Now, run

sudo apt-get update

Install mysql server

sudo apt-get install mysql-server -y

Create database

mysql -u root

then

CREATE DATABASE myapp;

Configure Laravel

Update .env to

[...]
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=root
DB_PASSWORD=
[...]

Migrate Database

Run migration (from myapp directory) to test, if everything works

composer install
php artisan migrate

Now you should be ready to run Laravel 5.5 on an Ubuntu 14.04 Codeanywhere container with PHP 7.1 and MySQL 5.7.

Install node / yarn

To install a newer version of node, run

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs

After that, install yarn

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

Hints

If you get the error “php: symbol lookup error: php: undefined symbol: pcre_jit_exec”, run this command

sudo apt-get install libpcre3

1 thought on “Install Laravel 5.5 at Codeanywhere with PHP 7.1 and MySQL 5.7”

  1. Hi,

    Just found an easier way to do the same thing 😉

    Open free account on https://codeanywhere.com
    Verify your email.

    Choose new connection
    Choose PHP Developement Stack with Apache, PHP, MySQL, phpMyAdmin and Composer preinstalled (node and npm is preinstalled as well)
    Choose a name let’s say LARAVEL

    composer create-project laravel/laravel laracasts_test
    sudo apt-get install nano
    sudo nano /etc/apache2/sites-available/000-default.conf
    change line: DocumentRoot /home/cabox/workspace/ to DocumentRoot /home/cabox/workspace/laracasts_test/public
    press CTRL + X, Y, Enter, to save
    sudo apache2ctl restart

    Go to left side panel, connections, right click on LARAVEL
    Choose INFO
    Click on the links provided.
    Enjoy your laravel app!

Leave a Comment

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

Scroll to Top