New Workflow for remote PHP Editing

by Stephen Fluin 2009.04.08

I have finally decided on a new workflow for PHP script editing. Previously I had my webserver located on my main desktop, but there were a lot of problems associated with serving an active website from a personal desktop. Once I switched to a remote hosted webserver, I had the problem of determining a new workflow for editing my files.

For my personal sites, I don't care about a little downtime. Based on this I am able to do editing on live, so that I don't have to develop and test locally, and then deploy and retest. This saves time, but it also pretty high-risk in the case where I break something. This risk is acceptable to me as a tradeoff for my time.

I have decided that the ideal way for me to develop remotely using my preferred IDE (currently Eclipse), and at the same time ensure that everything I finish makes it into my Subversion repository was to use SSHFS. I could have also worked remotely using command line or VNC forwarding, but I much prefer leaving my server without any sort of head or X server, and I want to continue to use a local IDE for everything I do.

SSHFS is a FUSE filesystem that uses SSH, so it is secure, and is setup in userland, so I don't even need root access to use it. Make sure SSHFS is installed by running:

sudo apt-get install sshfs

Once it is installed, create a local mount of a remote directory using:

sshfs user@server:<remote directory> <local directory>

Now I simply launch eclipse and add the local directory to my workspace as a project (I am even able to leave the .svn and .project files on the remote server with an appropriately setup htaccess file). One of the downsides is that I will need to establish this connection whenever I want to begin development. It is also possible to have local copy checked out into the same folder when you are not connected by simply specifying the -onoempty flag for sshfs. This will simply place the remote directory on top of your local directory, ignoring existing contents. When the connection to the remote server is broken, the old local contents will become visible again.