views:

409

answers:

5

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

A: 

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.

Byron Whitlock
Im sure that there were no concurrent connections. And secondly like i said the programs where identical, The only thing i can think different was in windows i was using mysql.dll and on linux -l mysqlclient
Shahmir Javaid
+1  A: 

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 ;-)

Pascal MARTIN
+1  A: 

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.

OIS
Well what im planing is not to use Apache at all just use IIS to run PHP. Would there be a difference if i used Apache on Windows or IIS
Shahmir Javaid
If you are familiar with IIS thats probably the best choice then. http://stackoverflow.com/questions/1197953/apache-vs-iis-php-performance-comparison
OIS
+1  A: 

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.

Mez
as far as i remember i was using vista, could it be because of that on not windows 7?
Shahmir Javaid
+1  A: 

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).

MarkR