Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

php/mysql sites running very slow on IIS

Posted on 2014-01-23
5
Medium Priority
?
2,271 Views
Last Modified: 2014-01-24
Hi,

I've recently installed concrete5 cms on a local server. It uses php and mySQL. It's running very very slow, we are talking about 4-5 second page load times. I've tried to figure out how to speed it up with no luck.

Yesterday I installed a crm on the same server (SuiteCRM) and the same thing is happening. It crawls.

Does anyone have any ideas I could try out to solve this?

Thanks
0
Comment
Question by:JayHine
5 Comments
 
LVL 11

Accepted Solution

by:
Murfur earned 2000 total points
ID: 39802734
First things first:
What version Window server?
What version IIS?
What version PHP?
What version MySQL?

Are any other sites running on the same IIS and are they also slow to respond or is it just this one?

The trick is to identify where the slowdown is.
Are there any development plugins running on IIS, e.g. xdebug?
If so, turn them off.

My first route is always to check db connectivity. Where is the MySQL installation, relative to IIS? Same physical server or different? Check the PHP connection string, hostname/ip address and port numbers and make sure they are available and open on the firewall.

I use this script to test the connection and report the speed:

<?php

	$host		= "localhost"; 
	$user		= "root"; 
	$pass		= "root"; 
	$database	= "test"; 

	ini_set("display_errors","0");
	error_reporting(0);
	
#	Get start time
    $start	= microtime();
    $start	= explode( ' ', $start );
    $start	= $start[1] + $start[0];

#	attempt connection
    $conn	= mysql_connect($host, $user, $pass)
	or die( "<div style='color: red;'>Error - Failed to connect to host</div><div>" . mysql_error() . "</div>" );
	echo( "<div>host <i>" . $host . "</i> connected OK</div>" );
#	Get end time
    $end	= microtime();
    $end	= explode( " ", $end );
    $end	= $end[1] + $end[0];

#	calculate total run time
    $total	= ( $end - $start );
    echo( "<div>host connection took " . round( $total, 5 ) . " seconds to complete</div>" );

	$start	= "";
	$end	= "";

#	Get start time
    $start	= microtime();
    $start	= explode( ' ', $start );
    $start	= $start[1] + $start[0];
	
#	attempt to select db
	mysql_select_db( $database, $conn )
	or die( "<div style='color: red;'>Error - Could not find database</div><div>" . mysql_error() . "</div>" );
	echo( "<div>db <i>" . $database . "</i> selected OK</div>" );
	
#	Get end time
	$end	= microtime();
	$end	= explode( " ", $end );
	$end	= $end[1] + $end[0];
	
#	calculate total run time
    $total	= ( $end - $start );
    echo( "<div>db selection took " . round( $total, 5 ) . " seconds to complete</div>" );
	
?>

Open in new window

0
 
LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 39802782
Here is an older question for something similar.  Part of the issue is a web server handles things a bit different than local and is not set up the same.  If you set up a test folder on your live server, do you get the same results?

http://www.experts-exchange.com/Software/Server_Software/Content_Management/WebBased_CMS/Joomla/Q_27808961.html
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39804152
There is no intrinsic reason for IIS to be slower than Apache.  You have to sort thru the details and find out where things are not up to speed.  But then maybe the application actually is slow.  Do you know of another installation where it runs faster?
0
 

Author Closing Comment

by:JayHine
ID: 39805945
Thanks, that speed script is very helpful as well.
0
 
LVL 11

Expert Comment

by:Murfur
ID: 39805996
You're welcome! So come on then... what was it?

I love a good story & need to know who did it - was it the butler in the library with the candle stick?
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question