« Previous Next »

Thread: PHP very slow on IIS7

Last post 09-24-2009 8:36 AM by lordg. 16 replies.

Average Rating Rate It (5)

RSS

Page 1 of 2 (17 items) 1 2 Next >

Sort Posts:

  • 11-30-2008, 4:20 PM

    • SWD
    • Not Ranked
    • Joined on 08-20-2002, 11:52 AM
    • Posts 11

    PHP very slow on IIS7

    New install of Win2008 and IIS7... setup php using following instructions http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/

    php pages are slow, especially the ones that connect to the mysql database. One page in particular will take so long that I get a 500 error (assuming this is timeout problem).

    I am only calling up 10 records with 2 fields to display.

    PHP error log shows nothing. IIS log shows nothing relating to this problem.

    I have copied the exact code to our IIS6 server and the pages come up fast. I coped the pages to the Apache/Windows server and the pages come up fast.

    This tells me something wrong on the IIS7 server.

    How to resolve??

    Thank you!

     

     

     

     

     

     

     

  • 11-30-2008, 6:27 PM In reply to

    Re: PHP very slow on IIS7

     Have you compared the php.ini from your IIS 6 server to your IIS 7 server? I can't think of anything off the top of my head that would cause PHP to be slow on IIS other than networking related issues such as TCP/IP connectivity/name resolution, etc. Is it just PHP that is slow, or is other content served by IIS slow as well?

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 12-01-2008, 12:32 AM In reply to

    • SWD
    • Not Ranked
    • Joined on 08-20-2002, 11:52 AM
    • Posts 11

    Re: PHP very slow on IIS7

    IIS6 is using ISAPI.

    HTML pages come up fine. the php page is fine as long as their is no mysql connection from what I can tell.

    Slow down with PHP pages connecting to MySQL locally are slow too. This one particular page will take 5 - 10 seconds to display and at times a 500 error will occur or content is blank.

  • 12-01-2008, 4:42 AM In reply to

    Re: PHP very slow on IIS7

    What happens if you run the SQL locally via the MySQL command line client? Does it still take a long time? Might be an idea to enable the MySQL slow query log if you haven't already.

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 12-05-2008, 6:28 PM In reply to

    • bills
    • Top 25 Contributor
    • Joined on 02-03-2006, 5:33 PM
    • Redmond, WA
    • Posts 433

    Re: PHP very slow on IIS7

    What version of PHP are you using? I've heard anecdotally that some people have database connectivity issues with 5.2.6...you might try going back to 5.2.5 to see if it gets any better. bill
    ~~~~~~~~~~~~~~~~~~~~~~~~
    Bill Staples
    Product Unit Manager, IIS
    blog: http://blogs.iis.net/bills
  • 12-05-2008, 6:54 PM In reply to

    • SWD
    • Not Ranked
    • Joined on 08-20-2002, 11:52 AM
    • Posts 11

    Re: PHP very slow on IIS7

     Thanks to everyone for help. Figured out the problem was a tcp/ip problem between iis7 server and mysql server!

  • 12-07-2008, 3:30 AM In reply to

    • festuc
    • Top 150 Contributor
    • Joined on 11-16-2008, 6:58 PM
    • Posts 36

    Re: PHP very slow on IIS7

    Can you tell us more about the problem and how you have resolved it?

    Thanks.

  • 06-01-2009, 7:46 AM In reply to

    • Onionman
    • Not Ranked
    • Joined on 10-21-2007, 12:54 PM
    • Posts 6

    Re: PHP very slow on IIS7

    Anyone have more insight in how to troubleshoot and remedy this? PH 4 currently outperfoms PHP 5 10 fold using FCCGI for us, in fact PHP 5 is so slow using MySQL as to be unusable.

  • 06-02-2009, 7:09 PM In reply to

    Re: PHP very slow on IIS7

    Do you have the same performance issue with PHP 5 using ISAPI? Any warnings/errors in your PHP log? Are any network connections been made by PHP?
    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 06-02-2009, 8:03 PM In reply to

    • Onionman
    • Not Ranked
    • Joined on 10-21-2007, 12:54 PM
    • Posts 6

    Re: PHP very slow on IIS7

    I haven’t tried ISAPI as I am using NTS version of PHP5(problem still occurs on TS version, but I will try TS ISAPI). Problem does not happen using FCGI on IIS 6. MySQL is on a dedicated server separate to the web server, so network connection are being made(latency <1ms and gigabit links). PHP 4 running FCGI works fine, PHP 5 slow as a dog(as in times out 8 out of 10 times) and really have run out of ideas, communication appears fine between the servers otherwise.

    Platform is as such. Web edition web servers, with content stored on file server, accessed via UNC paths with AD authentication. Problem still occurs if data stored on local drives with local users however, and even if I install MySQL on the web server performance is no better. Only thing I can think of is that the web servers are virtualised on Xen and/or the MySQL server runs Linux, but am not sure how to dig deeper to see where the problem lies. Problem is with FCGI PHP 5 and MySQL only, other languages(classic asp, ASP.net, Perl) all working fine when using MySQL as the data store.

     

  • 06-03-2009, 1:20 AM In reply to

    Re: PHP very slow on IIS7

     You're right, that doesn't seem to make a whole lot of sense on face value. So you're saying that PHP 4 using FastCGI on the same servers, connecting to the same MySQL server and running the same PHP application is performing better? Is this custom code, or are you using a publically available PHP app? What sort of page loading times are we talking about (2 secs, 5 secs, etc)?

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 06-03-2009, 4:07 AM In reply to

    • Onionman
    • Not Ranked
    • Joined on 10-21-2007, 12:54 PM
    • Posts 6

    Re: PHP very slow on IIS7

    All PHP code that makes mysql connections (wordpress, Joomla, Drupal) etc.

    PHP 4 loading times - normal ~1 second. PHP 5 same application (Joomla just tested on) Timout after 30 seconds. Same server.

  • 06-03-2009, 9:07 AM In reply to

    Re: PHP very slow on IIS7

    If it is timing out (rather than just running slow) I'd be looking at enabling and checking your php log. Rather than bothering with ISAPI I would give normal CGI a go as it's output can sometimes be a little more verbose than the other API's.
    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 09-20-2009, 6:00 AM In reply to

    • lordg
    • Not Ranked
    • Joined on 09-20-2009, 5:46 AM
    • Posts 2

    Re: PHP very slow on IIS7

    Hi Guys,

    We switched over to fastcgi on friday so we could move to the new sqlsrv driver for php. However, we no have the delay problem as described above.

    I tried the mysql solution to turn of the dns lookup, but this had not effect.

    The problem is not related to the sqlsrv driver, as we have not implemented it.

    Under isapi, the system runs correctly. But after switching to fastcgi and following the guide at http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/, it now performs very slowly.

    Whilst observing the mysql perfromance, only towards the end of the 15 second response time, does the mysql kick in and the queries are seen coming through.

    What I don't understand is why under isapi it works fine, but under fastcgi it doesn't, ans furthermore, how could this be then related to mysql?

    Would greatly appreciate anyones input.

    Thanks.
    G

  • 09-24-2009, 3:34 AM In reply to

    Re: PHP very slow on IIS7

    Have you tried under standard CGI? Also, have you set up your PHP logging?

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
Page 1 of 2 (17 items) 1 2 Next >
Microsoft Communities