Deploy Cloud9 Changes via S/FTP Using Git and PHPloy

Cloud 9 already comes with Git, PHP and Composer.

——————–
EXAMPLE FOLDER STRUCTURE
——————–
/home/ubuntu/website1
/home/ubuntu/website2
/home/ubuntu/website3
/home/ubuntu/PHPloy

——————–
INSTALL PHPLOY
——————–
Go to https://github.com/banago/PHPloy
Download and unzip the repo
Create a folder called “PHPloy” in Cloud9 in the “workspace” folder so that that folder is a sibling of your website folder(s).

——————–
INSTALL PHPLOY DEPENDENCIES
——————–
# Run the following commands in the Cloud9 Terminal
# move to the PHPloy folder
cd ~/workspace/PHPloy
# run Composer
composer install

——————–
INITIALIZE EACH WEBSITE WITH PHPLOY
——————–
# Run the following commands in the Cloud9 Terminal
# move into each website folder, e.g.
cd ~/workspace/website1
# initialize with PHPloy
php ../PHPloy/phploy.php –init

——————–
CONFIGURE S/FTP SETTINGS
——————–
Edit the newly-created phploy.ini file that was created in each website folder.
Replace the example values with actual values and paths for your web server.

——————–
INITIALIZE EACH WEBSITE WITH GIT
——————–
# Run the following commands in the Cloud9 Terminal
# move into each website folder, e.g.
cd ~/workspace/website1
# initialize with Git
git init

——————–
ADD OR EDIT WEBSITE FILES
——————–
If you don’t have any files in your websites folders, you can create them in Cloud9 or drag and drop them from your desktop.

——————–
ADD THE NEW OR EDITED FILES TO GIT
——————–
# Run the following commands in the Cloud9 Terminal
git add *

——————–
CHECK THE STATUS OF NEW OR EDITED FILES IN GIT
——————–
# Run the following commands in the Cloud9 Terminal
git status

——————–
COMMIT THE NEW OR EDITED FILES TO GIT
——————–
# Run the following commands in the Cloud9 Terminal
git commit -m “Changed website title”

——————–
CHECK THE STATUS OF NEW OR EDITED FILES IN GIT
——————–
# Run the following commands in the Cloud9 Terminal
git status

——————–
DEPLOY CHANGES TO YOUR WEB SERVER
——————–
# Run the following commands in the Cloud9 Terminal
php ../PHPloy/phploy.php

# If you get the error,

“Oh Snap: Unknown git-diff status. Use ‘–sync’ to update remote revision or use ‘–debug’ to see what’s wrong.”

do as it says and run the following command:
php ../PHPloy/phploy.php –sync

——————–
VIEW MULTIPLE SITES WITH VIRTUAL HOSTS
——————–

To preview multiples websites in Cloud9, you need to create virtual hosts. Unfortunately, Cloud9 only gives you 3 ports to use (8080, 8081, and 8082) so you can only create 3 virtual hosts. Instructions are at

https://docs.c9.io/docs/multiple-ports