Speed of PHP as CGI


#1

I’ve been looking around for a new host, and everything about Dreamhost seems great. But I saw that PHP is set up with CGI by default, and it seems the module version is fairly limited. I’ve heard that PHP as CGI is significantly slower than as a module, yet the knowledge base says otherwise. Is there something special going on to make it faster? And, if I were to compile my own PHP, would it still be just as fast?

I’m pretty new to this so forgive me if I’m being ignorant here.


#2

[quote]I’ve heard that PHP as CGI is significantly slower than as a module, yet the
knowledge base says otherwise. Is there something special going on to make
it faster?

[/quote]

PHP running as a CGI is indeed slower, but the fact that you’re running it in a shared web hosting environment has more of an impact, really. Only heavily impacted sites will usually be able to tell the difference, as PHP binary execution times come more into play there.

[quote]And, if I were to compile my own PHP, would it still be just as fast?

[/quote]

It’s be about the same speed as our PHP/CGI binary, as you’d have to run it as a CGI as well.

Basically, for a variety of reasons mod_php just isn’t as well suited to a shared hosting environment as PHP/CGI. I would recommend simply trying both out and seeing if one or the other is noticeably fast or slow ‘enough’ to impact your specific purpose, and going from there. I personally use PHP/CGI on most of my own sites, as I honestly can’t tell much difference speed-wise and the other benefits of PHP/CGI are important enough to keep.

  • Jeff @ DreamHost
  • DH Discussion Forum Admin