Apache vs. IIS PHP performance comparison - php

Does anyone know of any links to realistic performance comparisons of IIS vs. Apache for PHP hosting?
I am looking to utilise existing infrastructure for a change of technologies from .NET to a PHP application but I cannot find any information about PHP hosted on varying platforms. There is heaps out there about IIS vs. Apache in general, or ASP.NET vs PHP .. or any other language server vs server, language vs language but no server/language vs server/language.
My current direction is to use PHP with FastCGI.. looks pretty good. Just need to justify it or find a compelling reason to reject the big cuddly MS monster that I'm used to.
UPDATED
Windows environment would be Win2k3 running IIS6 with FastCGI serving the PHP extension. Also planning to use eAccelerator or similar script cache.

PHP Best Practices article -- Differences between PHP on WIMP and PHP on LAMP
Some of the differences you may encounter when developing with PHP on Win/IIS vs Linux / Apache.
The most obvious difference between WIMP and LAMP is definitely performance.
For years there has been an obvious performance advantage of LAMP over WIMP.
Only recently is their even a chance of closing that gap.
There are currently 2 projects underway that may help.
Currently available is IIS7 which is reported to have had PHP performance
enhancements built in with collaboration from the ZEND team.
An upcoming projects involves Microsoft engineers working with PHP engineers to get the next version of PHP (PHP5.3 which is not yet available at this time) to perform much better in IIS. This will no doubt make some progress toward WIMP catching up with LAMP in performance.

FastCGI on IIS will significantly increase the performance and will be comparable to that of LAMP. The difference will be in details, which are hard to pick and depends on what your configuration is and on what you scripts do. For example, file access on Windows is much slow than on Linux because of NTFS's ACL checks.
There is nothing particularly wrong with the Windows web stack. The only big reason I'd think of using Windows over Linux when human experience doesn't matter would be SQL Server. Otherwise WAMP, WIMP and LAMP perform comparably and performance differences won't show up until heavy load.

Related

What are the differences between IIS and Apache for PHP hosting?

I have spent a fair amount of time working with PHP in both IIS and Apache server (Windows) configurations. I have seen suggested a couple of times that Apache is preferred over IIS.
I had been under the impression that one of the primary reasons for Apache over IIS was that performance under CGI through IIS was significantly slower. However, the support through Fast CGI seems to have fixed much of that issue.
Another issue is certainly licensing costs, but assuming that isn't an issue, what are the other differences, assuming a Windows-based platform?
You're right, IIS FastCGI nullifies any arguments about PHP on IIS being slower than Apache. Assuming a Windows Platform, leveraging IIS gives you all of the benefits that come with using IIS like: a brain-dead simple path to clustering; leveraging the Web Platform Installer to get a jumpstart on running common PHP apps like Drupal; and the ability to combine technologies like PHP and ASP.NET in the same website.
The most obvious answer is that if you work with other people, administrators who work with PHP are much more likely to have Apache experience rather than IIS experience. So in larger companies in particular we tend to support these trends because it reduces real and perceived knowledge burden and training cost. That is, we always use Apache for PHP, and we always run it on Linux because it is really easier to hire web admins who have supported PHP with Apache on Linux.
If its just you then obviously this doesn't apply. You're going to hear Apache suggested more because its what more people have used, but that doesn't necessarily mean anything to you. If you've got a lot of experience with both then you are in a better position to answer this yourself than the majority of people who you'll see opinions from.

Windows 7: IIS 7.5 w/ PHP & MySQL or Apache w/ PHP & MySQL?

I just got my self a new laptop, it runs on windows 7 and i am in deliberation what dev environment to set up.
I have most of my life used wamp set up, on windows machines for local dev environments. Here i recently installed IIS and it looks very convenient to set up sites and so on and so forth.
So I am thinking of installing php and mysql and runing local dev environment via IIS. The question is as I am fairly new to IIS. Are there any draw backs to running php/mysql via IIS in local dev environment. What are my limitations, will running php/mysql create any limitations if any that will hinder development and might effect deployment.
Back in a day i had some exposure to ISS with php running on server, it was long time ago, but php was not completely supported and some dev issues arose.
Thank you guys for any input. Greatly appreciated.
Usually it is a benefit if you can use identical environments for development and production. So the question is:
On what stack do you deploy you applications?
I personally believe that apache on windows is still a better solution to develop PHP. Reasons:
much more documentation about the interaction between PHP and apache (for example url rewriting, proxying, etc...)
apache is the de-facto standard for PHP, so if you plan to deploy to apache later, you will face less potential problems due to platform differences (also regarding the rare subtle bugs which can plague ported software)
I find it easier to get meaningful error messages out of apache than from IIS
I try to install the same PHP and Apache versions I will be deploying to, so the chances to have differences is minimal...
I would go for Apache - mainly for the .htaccess functions - rewriting etc are slightly more tricky in IIS and you may not get as great portability when transfering to a LAMP setup.

PHP, MySQL | Windows vs Linux

Well the title does the explaination. Which one is faster PHP/MySQL on Linux or on Windows.
Question 1
I know that MySQL is slower on Windows, because i tried to run a C++ program on Windows to access MySQL, it took a year every time it had to open a connection. When i ported the exact copy into the linux enviornment it was lightning fast.
Im not sure why the difference is, Maybe cause when we talk about Linux every thing is million times faster, but it would be good to know why such a massive difference.
Question 2
I have set up PHP on IIS and mySQL on Windows ive just tested a very small application on this setup and it seems fine. What i really want to know is that is there any performance issues for PHP in Windows rather than Linux?
Edit Windows Vista Was the OS i tried on Originally, Havent Tested W7. Fedora 10 was the Linux :D
They should be the same speed eventually. If you do an unscientific, unfair test, you might show a difference.
Process startup speed might be different. In particular, process startup might be slower on Windows. This shouldn't matter too much in production unless you're using a model which creates new processes on a very frequent basis, which will be inefficient on either.
Run a performance test of your actual application, with a large number of requests, over a significant length of time, on production-grade hardware. It's the only way to tell.
Needless to say, I can safely say that almost nobody chooses Windows vs Linux based on performance. Usually it's what they are capable of managing in production and have hardware / software support for.
If you're going to install 1000 boxes in production, Windows server licencing might get expensive (depending on your deal with MS). If you are only going to install a few, it probably doesn't matter (supporting the servers will be much more expensive).
Things are slowly getting better on Windows, with IIS 7 and PHP as a FastCGI ; see http://php.iis.net/
But I have never heard anything good about PHP + IIS6... Never worked in this configuration myself, though ; so I can't speak of experience.
One thing to consider is that Windows still (things are slowly getting better too) seems to be considered as a second-class citizen, when it comes to PHP...
And it's harder to get exactly the version of PHP you want (on Linux, you just recompile, and that's definitly not hard at all) ; even more for PECL extensions, btw...
As a sidenote : you can run PHP on windows with Apache ;-)
PHP is just about equally fast on Linux and Windows, variations among different functions.
PHP on linux used to support more functions Windows did not like pcntl_fork and socket_create_pair. It seems that with the release of version 5.3 those now works on both (from the PHP documentation).
I dont know about any speed difference between Apache on Linux vs IIS, or Apache on Linux vs Apache on Windows.
1) This is probably due to your mysql server trying to do a reverse lookup, and/or your DNS for localhost on the windows machine being incorrect.
2) PHP is the same speed, overall, however, the interface to it (apache module, cgi etc) may not be as fast.
Not sure what the issue was unless you had many of concurrent connections and/or were not running on windows server. There should be no noticeable speed difference between the two. There was something else going on in your program.

Performance differences running PHP under Windows/IIS 7 vs. Linux/Apache?

There is a PHP application right now on a Linux box running under Apache with MySQL. Since we are a windows shop, management wants to get rid of the Linux box and move everything over to windows. Is there a performance difference between the two platforms? Or, is there any significant difference at all, in terms of performance or management?
Microsoft had a team help out optimising PHP for Windows, which work is part of PHP 5.3. Some figures I've seen places the performance close to PHP + Apache on a unix system. Before 5.3 (Which means currently, since 5.3 isn't out yet), performance is bad on Windows. I think there are some patches and tricks you can pull to improve it, but it's going to cost you a bit of performance. That may or may not be a problem; People have a tendency to overestimate performance.
Note that there are other reasons to use unix than just performance. Code may not be portable and even though the core php runs fairly ok, you can well get into trouble with php-extensions and third party libraries. No matter how you look at it, Windows is a second-rate system for running php on.
If your application isn't huge or get hit a couple thousand times per second, there's no difference between the two.
LAMP == WAMP in php small projects. Just install something like XAMPP if you want your environment to be as close as possible to your existing one but in Windows.
Good luck with your project!
You should consider the MS WebPI (download at www.microsoft.com/web ) which would install the entire stack for you to run PHP in IIS7 environment.
the performance is comparable for most apps.
I've just done this for the same reason. Mgt wanted to get rid of the Linux box. I was able to completely move my php application and MySQL database. It took longer for me to configure PHP for IIS than it did for me to move the existing content over.
I have found though that the IIS server is a fair bit slower when it comes to loading pages and images. Where in Linux it appeared instantaneous, in IIS it takes a half second for the page to load and another second for images.

PHP website, should I develop into a Linux distribution instead of Windows?

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.
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.
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.
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.
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.
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.
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.
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.
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.
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 ;)
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.
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.
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.
5 years later: My opinion is to use the Linux solution. There are many advantages for using PHP in Linux. The primary reason is the level of help available from the community. PHP seems to be optimized for Linux environments as well.
There is also safety in numbers as an overwhelming number of sites are hosted and run with LAMP solutions. There are a wide range of frameworks and CMS' that run best on Linux with Apache2.
Make your life easier and start learning PHP straight away.

Categories