PHP files loading very slowly, even if they have no PHP code

fastcgiiisiis-7.5PHPwindows-server-2008

  • Windows Server 2008 R2 Standard
  • IIS 7.5
  • PHP 5.3.28
  • FastCGI

I have a WordPress blog in a subfolder of an ASP.NET site that has started running very slowly. After experimentation, I've found that all PHP files load slowly, even if they don't have any PHP code inside them to execute. <h1>Hello!</h1> by itself in a text or HTML file loads quickly, but in a PHP file it takes forever.

PHP is running via FastCGI. All the recommended php.ini settings are set, except for open_basedir, and setting it via ini_set() doesn't help.

Answers on similar questions seem to always talk about MySQL, but I seem to have eliminated MySQL from contention here.

Best Answer

I ran into the same issue on my Windows 2008R2 server. I followed two tips that seem to have made the difference.

  1. Use the 32-bit version of PHP even if your machine is 64-bit. It is much faster
  2. Enable Output Caching in IIS for PHP files. To do this: a) Go to IIS and select your server in the Connections pane on the left b) On the right, double-click on the Output Caching option c) Add... d) In File Name Extension, put ".php" Check Kernel-mode caching Make sure the "Using file change notifications" option is selected Click OK

Test and see if that does the trick for you.

Another idea is to install Windows Cache Extension 1.3 for PHP 5.3 (or whatever version you are using now - I am on 5.6) using the Web Platform Installer.

Finally, use the WPI to install PHP when you do it. It configures the server well and you dont leave anything out.

Hope this helps!

Related Topic