News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Kevin Schroeder:
Why is FastCGI /w Nginx so much faster than Apache /w mod_php?
January 08, 2013 @ 12:43:23

In this new post to his site Kevin Schroeder takes a look at the performance difference between Apache+mod_php and Nginx+FastCGI and why the second is noticeably faster than the second.

I was originally going to write a blog post about why NginX with FastCGI was faster than Apache with mod_php. I had heard a while ago that NginX running PHP via FastCGI was faster than Apache with mod_php and have heard people swear up and down that it was true. I did a quick test on it a while back and found some corresponding evidence. Today I wanted to examine it more in depth and see if I could get some good numbers on why this was the case. The problem was that I couldn't.

He uses a "hello world" script as a baseline to do some testing and the ab to run the numbers. His results show a pretty significant difference between the two setups and an "strace" on Apache showed a clear "winner" as to why it's slower (reading the .htaccess file). Once he turned this off, though, Apache jumped up and started performing better than Nginx.

This all makes sense. mod_php has PHP embedded in Apache and so it should be faster. If you're running only PHP on a web server then Apache still seems to be your best bet for performance. And if you are seeing a significant performance difference then you should check if AllowOverride is turned on. If it is, try moving that into httpd.conf and try again.
0 comments voice your opinion now!
nginx apache fastcgi phpfpm modphp performance htaccess


blog comments powered by Disqus

Similar Posts

Hiveminds Magazine: Microsoft is in control of the PHP and Apache projects?

Ernies Blog: Switching Between Multiple php Versions Using Apache on Windows

Reddit.com: Frameworks, how are requests per second important?

Kevin Schroeder: Why you should not use .htaccess (AllowOverride All) in production

PHPMac.com: Building and Installing Apache 2 and PHP 5.1.1 on Mac OS X 10.4.3 Tiger


Community Events

Don't see your event here?
Let us know!


framework introduction podcast opinion language symfony2 conference voicesoftheelephpant release performance laravel part2 api example series application community configure php7 interview

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework