4

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

1
  • Minus Why..? (* required - at least 15 characters) Commented Aug 7, 2009 at 13:29

5 Answers 5

3

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

1

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.

2 Comments

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
If you are familiar with IIS thats probably the best choice then. stackoverflow.com/questions/1197953/…
1

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.

1 Comment

as far as i remember i was using vista, could it be because of that on not windows 7?
0

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.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.