Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kepardue

macrumors 6502
Original poster
Oct 28, 2006
354
7
I'm definitely seeing the benefit of doing web development locally and then uploading my files to a remote server when I'm ready to go live--especially since I'm the proud new owner of one of the Santa Rosa MBP's and can now be a mobile developer. Of course, there is the issue of needing a separate configuration file for remote and local, what do you folks typically do in that situation?

In my case, developing PHP, I'm thinking of replacing, for instance, config.php with a switch statement based on what the $_SERVER['SERVER_NAME'] says (e.g. if MacbookPro.local then load configuration.dev.php, else load configuration.production.php).

Just wondering, how do you guys manage multiple environments? Currently I'm using PDT/Eclipse, but I'm probably going to get Dreamweaver CS3 very soon. Are there tools in Dreamweaver to manage these sorts of environments?
 
I personally prefer local as its easier to get a feel for what's going on, and then uploading later.
 
Design wise, I prefer to work on the server so I can see everything in Mac/PC safari firefox IE etc on multiple computers simultaneously. I usu. work in a test directory.

Re: PHP.
I use mostly relative references to include a PHP config file that has my URL, root, etc.

So I develop locally and when it's done, just upload it and change the config file.
 
I do my dev work on my Mac of course but the actual files are loaded via NFS from a linux PC, with the linux configuration (almost) matching that of the live web server. Basically every site I do is PHP based so I'll usually load them via apache on the linux box using something like test.customers.example.com (i've got *.customers.example.com pointing at the linux box so i can use whatever i like at the start)

I usually have a switch in the code as you describe that selects either the development or production settings, based on the SERVER_NAME. Most of the configuration stays the same - only a few variables such paths and email addresses change so I don't usually bother with separate files for those.

I then use scp or rsync to update the live web server with the files from the PC.

You could get basically the same results by missing out the PC and just running Apache & anything else necessary on the Mac itself.
 
I develop locally and keep everything on source control (currently Subversion). When I need to deploy it, I tag the files, check out to a temp directory, build them (if necessary), and then FTP them to the server. I never upload directly from my dev environment.

As for the configuration files, the copy in Subversion has the settings for the server, while I have a copy in my local computer with its configuration.

Yes, I know I am a bit obsessive about configuration management, but I think it is the only way to avoid silly mistakes. :p
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.