Wednesday, January 26, 2011

Does nginx invoke php when image resources are requested?

That's the overhead in apache,does it exist for nginx?

  • Apache doesn't really invoke PHP for image resources. Apache with mod_php embeds the PHP interpreter into it's process when a PHP file is requested and then re-uses that process future requests such as images. So in a sense Apache doesn't have PHP parse the images but the PHP parser is in the process using memory.

    Nginx uses FastCGI to talk to PHP which means that the Nginx workers do not contain PHP and instead it talks to external PHP processes. You need to explicitly tell Nginx what to send to PHP so if you don't tell Nginx to send image files to PHP then it won't.

    From Martin F
  • Apache doesn't "invoke" PHP, however, the php interpreter, once loaded in memory, stays in memory until the process exits (so that it doesn't have to be loaded again).

    Nginx never does anything relating to PHP. Instead, it can optionally invoke a PHP CGI or FastCGI to process PHP pages. However, that's handled by a separate process -- much the same way that Apache and MySQL are handled through separate processes even though they can pass information back and forth between eachother.

    From tylerl

0 comments:

Post a Comment