Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I want to start a home-brew pet project in PHP.

I've spent some time in my life developing in PHP and I've always felt it was hard to organize the development environment efficiently.

In my previous PHP work, I've used a windows desktop machine and a linux server for development.

This configuration had it's advantages: it's easy to configure Apache (and it's modules)/PHP/MySql on a linux box, and, at the time, this configuration was the same like on production server.

However, I never successfully set up a debug connection between my Eclipse install and X-debug on server. Transferring files from my local workspace to the server was also very annoying (either ftp or Bazaar script moving files from repository to web root).

For my new setup, I'm considering installing everything on my local machine. I'm afraid that it will slow down workstation performance (LAMP + Eclipse), and that compatibility problems will kick-in.

What would you recommend? Should I develop using two separate machines? On one? Do you have experience using one of above configurations in your work?

share|improve this question
    
Your dev machine should be the same stack as your production machine. Use samba to create a network share, and that solves the moving-files problem. Take a look at the zend tools for debugging to see what they have. If at all possible, use full databases, version control, etc... –  gahooa Nov 20 '12 at 4:53
    
I Use Codelobster + XAMPP server –  Stas Ustimenko Jan 21 at 15:38

7 Answers 7

Sandbox. If at all possible, you should have a complete environment on your machine including database, web server, caches and what else that is part of the actual live installation. This does not mean you need 10 load balancing web servers or a million row database, rather it should contain enough of it to be representative of the real installation. You should also be able to re-create this sandbox with a simple command (including populating databases, installing environment etc).

This applies to all languages and not just PHP.

share|improve this answer
    
The OP seems to be worried about compatibility issues (between windows and linux?) - one of the important parts of the question seems to be "am I ok sandboxing with a windows machine, or will there be negative side effects related to performance and compatibility issues" –  blueberryfields Feb 12 '11 at 22:43
    
Ah I see. But it still applies I think. If you're targeting Windows, then your sandbox should be in Windows. –  Martin Wickman Feb 12 '11 at 22:45
    
The problem is I'm using Windows but target machine is on Linux. –  pixel Feb 12 '11 at 23:29
2  
@pixel, considered installing virtualbox or vmware player and installing a Linux in a virtual machine, and then work there? –  user1249 Feb 13 '11 at 0:18
    
I second the VirtualBox suggestion. I've used this method for PHP development on a Windows box (with a Linux image running the resulting code); it was simple, reliable, quick to set up, and had no noticeable performance issues. –  Daniel B May 3 '12 at 6:32

XAMPP is an excellent lightweight local development stack. In windows it comes with a great little administrative GUI that allows you to run your servers (PHP, Apache, MySQL, etc.) as processes. I've found that in XP/VISTA/7 this tends to eat up much less processing power than running them as services, and with XAMPP you can start and stop them individually.

share|improve this answer

If you dislike (S)FTP and don't want to setup your online test server for updating when you commit to SVN or Git, you may want to try Dropbox to sync your development folders with your online test server, that way as soon as you make a modification locally, the file gets immediately transferred to the server without requiring you to do anything.

share|improve this answer
1  
File transfer is annoying but solvable. For me it's a lot harder to debug PHP scripts without working debugger. –  pixel Feb 12 '11 at 23:32
    
Fair enough, debugging would be a higher priority indeed. –  wildpeaks Feb 12 '11 at 23:39

As far as the debugging issue goes, I prefer PhpStorm as my IDE of choice because of the ease in which you can integrate it with Xdebug. It costs a little bit (usually they run specials for 25%+ off) but it's well worth it. They even have a 30 day trial so you can test it out.

I used to use Eclipse and it's hard to go back now. Like I mentioned before, you can integrate xdebug really easily and it comes with a Chrome plugin so you can turn debug listening off and on. Here is the best tutorial I found on how to do it.

PhpStorm also works with SVN right out of the box. Which brings me to my next point, use SVN (or Git if you prefer, just some sort of versioning). That will make uploading changes to your server much easier. You'll also have backups and commit logs which will definitely help you in the future.

share|improve this answer

I suggest WAMP

WAMPServer to be more stable and is user-friendly. I have been using this for 2 years for PHP development especially in database management and web portal development.

Please note that XAMPP never ever worked with sessions, always give a lot of errors. Also, it's a bit harder to secure.

In WAMP, you only have to click the wamp icon and chose "put online" to make it available from other computers, or "put offline" if you only want it accessible from the local computer.

You may watch the video here to gain more insights

share|improve this answer

Lets take all your concerns one by one.

I do not know about your machine configuration but I have definitely found Eclipse to be more resource hungry. Someone has already mentioned PHPStorm. It is not heavy as Eclipse and has nice set of features too.

For debugging purposes also, PHPStorm is easily configured with Xdebug.Please have a look at this link. You will find most of your remote debugging answers here.

If you want to test in different environments, you can easily create VMs using vagrant. It is very useful esp when you want to replicate production environment and it works like charm. IMHO, you do not need two machines for dev.

Moving files from local workspace to server, you might want to use git and create your own build process going further.

share|improve this answer

Eclipse has a Remote Systems plugin. This will let you directly load, edit, and save files over FTP and SSH just as if they were local files. No need to ever use FTP to transfer edited files to the server.

I generally recommend to PHP devs to not work with a local (same machine) WAMP install. Instead, get used to working with a 'remote' machine via SSH (even if its on your LAN), as that's likely how you'll have to manage a live server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.