Hope this helps someone. After two days of toil I finally got a spark project up on a c9.io workspace here are the steps I took. This assumes you have already bought a Spark license at https://spark.laravel.com/
- Create the c9 workspace.
- Because I ultimately want to deploy to a digital ocean droplet and the latest laravel / spark requires PHP >5.6 you need to update php on your c9 workspace. I found using php brew works the best: ( https://community.c9.io/t/how-to-upgrade-to-php7/1379 ) You can use phpbrew on Cloud9. I found that the standard installation process works fine, just run the commands below. We first install the libmcrypt-dev package to avoid running into dependency issues during the build:
$ sudo apt-get update $ sudo apt-get install libmcrypt-dev
Next, we download phpbrew and move it to /usr/local/bin:
$ curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew $ chmod +x phpbrew $ sudo mv phpbrew /usr/local/bin/ $ phpbrew init # add this to your ~/.bashrc: $ [[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc $ phpbrew lookup-prefix ubuntu
Once set up, we install and load PHP 7:
$ phpbrew install 7.0 +default $ phpbrew switch php-7.0.1 $ phpbrew use php-7.0.1 $ php -v PHP 7.0.1 (cli) (built: Dec 29 2015 22:04:43) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
- Next make a phpinfo.php file in your workspace root if you fire up your workspace you will notice that apache still think php is 5.5. You need to disable the old php module and enable the new php 7.0 module . From Roland on C9.io:https://community.c9.io/t/how-to-upgrade-to-php7/1379/17 I had the same problem. You have to disable the php5 module in apache2 and then enable the php7 module:
$ sudo a2dismod php5 $ sudo a2enmod php7.0
When I did this I got an error ‘could not parse envvars’ but I solved this by temporarily renaming this file in the /etc/apache2 directory. Then restart apache.
If you do not see php7.0 module then do the following:
$ sudo add-apt-repository ppa:ondrej/php -y $ sudo apt-get update -y $ sudo apt-get install php7.0-curl php7.0-dev php7.0-gd php7.0-intl php7.0-mcrypt php7.0-json php7.0-mysql php7.0-opcache php7.0-bcmath php7.0-mbstring php7.0-soap php7.0-xml $ sudo apt-get install libapache2-mod-php7.0 -y
- If you going to use Spark then you also need PHP Zip so install
$ sudo apt-get install php7.0-zip
- Clone the Laravel Spark Installer into your workspace root https://github.com/laravel/spark-installer/tree/master/src
- Add Spark to your workspace path.
$ vim ~/.bashrc
Add these lines at the end of your file
# Laravel Installer export PATH="$PATH:$HOME/.composer/vendor/bin" # Spark Installer export PATH="$PATH:$HOME/workspace/spark-installer"
- Now you are ready to install Spark. Got into your spark-installer directory and run composer install. That should install spark and all its dependencies.
- Register Spark, got to https://spark.laravel.com/ and login. In your user settings go to the API page and create a new API token.
- From here you can follow the install instructions in Spark’s documentation https://spark.laravel.com/docs/3.0/installation
- Remember you have to create your database and database user and set them in your project .env before you can run php artisan migrate.
- The only other problem I had was that the npm intall for my spark project was failing. So to fix it I upgraded nodejs to v 6.4. You can do this c9.io by running
$ nvm install 6.4 $ nvm use 6.4
Then run your npm install
$ npm install --save