views:

839

answers:

12

Hi,

In few months I start a project in PHP and I am hesitating to do like usual : develop on my Windows Vista 64bits machine. Since I know few things on Linux, I think it can be a good way to learn by working on a Linux distribution.

Do you think it's a good idea or not? I would run a VirtualBox with Ubuntu (on my Vista64bits). I was thinking to install XAMPP to be able to develop in PHP.

If you think it's a good idea, feel free to suggest me some tutorial about what I should know with Virtualizing an OS, or Linux/dev.

Update I have build many website in PHP with Windows, the question is more about if it's a good way to start learning Linux by developing on it via a Virtual machine? I have 4 gigs rams, will it be smooth if I install Eclipse in the Virtual Machine? etc.

+4  A: 

PHP should be the same on any platform - so where you develop shouldn't matter.

However, in my experience and observation,more sites running PHP are running on Linux than Windows.

Getting Apache and PHP setup on something like Ubuntu or Fedora is a cinch, and testing everything is pretty simple, too.

Also, when you go live with your site, what platform will it be running on? I prefer to do development on the platform it will be running on whenever possible.

warren
+3  A: 

Personally, I don't think that for local production you should be using a VM. Would you be running your IDE inside the VM too?

If you are aware enough of the pitfalls of moving between Windows and Linux environments (such as case sensitivity and permissions), you should have no problem developing on Windows and deploying on Linux.

Eran Galperin
PHP is a lightweight language, and for development I also think VMs are great - but that could be personal experience only
warren
PHP itself is lightweight, but what about the IDE? or do you plan on using simple text editors only
Eran Galperin
I agree with not developing in the VM, I only test inside VMs. However since you are running Vista 64-bit, you might have enough power (cpu/ram) to run even a heavy IDE like Eclipse inside the VM.
Steve Tranby
You might have enough power, but I don't think it's necessary. Also, I have many hungry processes running at the same time, such as photoshop, firefox etc.
Eran Galperin
Yes the IDE would have been in the Virtualbox
Daok
+3  A: 

Working on a Linux distribution is defnitely the easiest way to learn it. And setting up some servers and doing some dev work is an excellent start.

Virtualising Linux is also really easy. I've done it quite a few times and it's really obious. Also, going this way will ease you into using Linux, much better than just jumping in and finding out your wireless card is unsupported like I did :)

As for PHP development on Linux... I've done some PHP coding on Windows and on Linux and I can tell you there's very little difference between the two. I use Eclipse on both platforms and Apache &MySQL / XAMPP. The only major difference I've seen is that Linux is much more finicky about permissions and case.

fluffels
A: 

In my opinion you needn't to develop in a linux distribution. Web Development can be done from any OS. I don't know, why you are programming for the web... as a professional? for your personal homepage? I think, it's enough to get some free webspace running a PHP Server and to upload your files there... it doesn't take you much time and there are less things to manage.

a german student ;)

+1  A: 

while XAMPP works great, running Apache and PHP on Linux is a given; while on Windows it's something extra you have to do... and support. Also, most parts of the stack are far more optimised and mature for a POSIX environment. The database engine(s) performance is particularly sensitive to the available primitives.

Most OSS runs on windows, but it's a round peg whammed on a square hole.

Javier
A: 

Use the OS your deployment server will be running, and it is highly probable to be linux. I have recently seen a deployment gone ultra bad cuz it was developed using wampserver and deployed on CentOS. With major differences in apache and PHP config. So know your deployment server and match it as closely as possible.

Midhat
+1  A: 

On principle, I would advise against "learning by doing" in a real project - unless it it really small, or you have doen very similar projects before, so that the learning curve on project related issues would not be steep. In that case you may have ressources free for learning about the developing environment.

Treb
+1  A: 

Generally I like the Linux environment better than Windows. Mainly because all the CLI tools you would need are provided and Bash beats cmd.ext any time. But with Cygwin I find even Windows a comfortable development environment.

Regarding PHP development I can't really see how it would be much different. Maybe there is some benefit in being forced to make the code more portable (things like line endings, forward slashes in filenames and such) if you use booth systems.

As a desktop or workstation there isn't much difference between the two. I find that the biggest differences lies in how you administer them, but hopefullt you have some other people doing that for you.

John Nilsson
+4  A: 

You should really develop on the same platform where you are going to deploy. I'm not saying it is bad to do differently, but it can save you some pain in the long run. OTOH, you might learn faster about platform differences that way. So, the main question is: do you want to have a production system running ASAP without much headache? Or, you want to spend some time and make some effort to learn how to develop cross-platform stuff?

And yes, there are differences. For example, case sensitive and case in-sensitive filenames. Then, some PHP functions use native C functions that have different implementation. For example, printf() does not produce the same amount of whitespace for some of the types. Resolution of time measurement (milliseconds vs microseconds) can be different, etc. Then, you have different ways filesystem permissions are handled. These are just some recent problems I've found that I can remember off the top of my head.

Milan Babuškov
+2  A: 

PHP is not the same on all platforms, and until very recently the windows versions had problems which were not found in the Linux versions. Lots of useful features are *nix specific.

I would echo @Milan's sentiments about developing in the deployment environment. You learn a lot more about the deployment environment by doing so too.

On the VM issue, if you want all your Windows tools and your windows machine, setup a linux server in your VM (can have a GUI if you want, but you're going to mainly use it as a server). Set it up so that windows can view the apache install running in your VM and you use samba shares to access the vm's files like a drive in windows. That way, you develop in windows but are testing deploy / setup on a running linux server. While two devs at my shop run Ubuntu, a third needs to use Photoshop and various other bits of windows software all the time, so she uses this method of running a server in a VM but developing from windows.

Oh, and if you're running on Linux, don't use XAMPP! A few simple commands will have you up and running and you'll get a much better understanding of your deploy. XAMPP is fine, but it's for OS's that don't have Linux's package management.

reefnet_alex
A: 

Try creating a development environment using VmWare Player. I have several Linux environments that I run on my Vista laptop. You could also just dual boot. I use Ubuntu, it is easy.

Clutch
A: 

The side effect of developing inside a VM: more overhead and eventually the needs of additional tools to make the development more comfortable. Often people need special tools for their development like Photoshop or some vector design tools not available on Linux. If the working copy of the project is inside the VM, it makes sense to have easy access to it. So you will setup SAMBA (which makes often problems with the login from XP) or setup SSL(SFTP)/FTP. Also you must learn how to use networking with the VM (NAT, bridging, port forwarding).

On the other side, developing on another platform as the target can give some headache. I found myself often confused with .htaccess files for password protection, because oft the different path on Windows/Linux. If you forget to change this entries later on the production server, you have a problem...

A better solution: use the best of both worlds. A VM eventually running later headless (no gui, more like a "remote server") with Ubuntu/Debian/FreeBSD) and only running the needed servers (Apache, MySQL, FTP, SSH...).

Eclipse or the other development tools on Windows/Mac.

devarni