views:

140

answers:

5

Hi, my project is a PHP web application. This applies to my test server (local), not production server! I am also the solo developer on this project (however, that may change in the very far future). Also, all my source code is committed to a repository and the production server gets the source code from the repository.

I do my development in Windows while my test server runs on Ubuntu (perhaps you can also recommend me another distro that is easy to use and can serve as a good web server). I need an elegant way to interface between the two environments. Currently, I do my coding in Windows and then FTP the changed files to the test server. However, this is quite cumbersome and tedious since I have to manually go to my FTP client each time. Suggest me something elegant please! Perhaps FTP sync? or OpenVPN (where the root www directory on test server is acts like a folder in Windows)? Thanks for your awesome time!

A: 

Some ideas:

  1. Use a server environment under windows (e.g. EasyPHP).
  2. Use a development tool that can save over FTP (e.g. ultra edit).
  3. Use a network drive connected to the remote machine via FTP.
  4. Use a network drive connected to the remote machine via Samba.
  5. Run a linux distro inside a virtualization tool (e.g. virtual box) and write from the windows host to a share directory of the guest host.
  6. Use dropbox to sync files between machines (there is more a hack than an "enterprise" solution).
Pascal Thivent
+4  A: 

I prefer SFTP to FTP.

That said, ExpanDrive lets you map SFTP servers to local drive letters, which then means you can use any text editor to access your files directly on the test server, or use other mechanisms to keep the files in sync. Since they show up as two local drives, you can use just about any product out there.

If you want to use FTP, you can just map the drive in Windows Explorer. If you open up My Computer, then go to Tools > Map Network Drive, you can map a FTP server folder to any local drive. Just type in the address as the folder, ie. ftp://[email protected]/htdocs

This will atleast save you a trip to the FTP client...

Matthew Scharley
A: 

Is there any reason you couldn't just test on your local computer? At my job, we all develop and do developer testing locally, most of us using Windows. Our production and test servers are all linux based. Working locally is really nice, because you don't need to worry about making changes on the server with every small change.

Another option would be to create a checkout or working copy of your code on the server, and then run svn up or svn export (or equivalent using your version control software) each time you change the code on the server (assuming you are sshd into the server). This is kind of slow, but it's easy. The other option would be to write a script that goes through the svn logs for the recent commit and only exports or updates the ones that changed. This is much faster, and for all I know, there is already something out there that this.

Finally, some IDEs allow you to edit files live over ftp\sftp. Basically the IDE downloads a copy of the code and then reuploads it when you save.

notJim
My test server used to be Windows (used WAMP). However, I was kind of picky and wanted the test environment and production environment to be consistent to avoid any headaches in the future. Also, I'm having problems getting gettext to work in the Windows environment so that's another reason (for internationalization purposes I suppose). And thirdly, I would much rather free up the system resources that take up my computer just to run a server. Hope that explains it, and thanks for your comment! I might just go to svn route to ensure I'm familiar with it for production.
Axsuul
Oh, and here is the problem I am having with gettext: http://stackoverflow.com/questions/1473207/php-gettext-on-windows
Axsuul
+3  A: 

Easiest would be in Ubuntu, right click a folder then click "Sharing Options", then share the folder. In Windows, connect to the share, and work on that copy.

If you're using version control, using continuous integration like Hudson ( https://hudson.dev.java.net/ ) would help if you create a task that builds/exports the website for the testing server. This approach would be better in the long term, but you'll waste a day setting it up initially.

Mead
I tried all suggested methods and the sharing folder option in Ubuntu worked best for me. It was stress free and gave me what I wanted. Thanks!
Axsuul
A: 

Currently I develop on windows (PHP) as well and deploy on a Linux box for testing and production. This is how I do it.

  • Set up a local development server with e.g. WAMP.
  • Set up your code base in version control, e.g. Subversion.
  • Checkout your code base onto the testing/staging server, not just only on your local dev. environment.
  • In the early stages of development you want to deploy to the testing environment A LOT to sort out any discrepancies between your windows and linux environments. When your programming efforts turn more into program flow type programming this constant testing will probably slow down. But still take the effort to test on a regular basis.
  • To test your code base on staging do an svn update. I just log in with an SSH session to do this. A key thing here to note is that you do not have to make any config changes to your code base. If you do need to make config changes to your environment on staging it worth while spending the time to SCRIPT this process rather than this being a manual process.
  • Do the same for production. I use an Subversion check out on production as well. Make sure you set you .htaccess file to deny access to your hidden .svn folders and script the deployment especially if there a config changes necessary.
Luke