Solved

php/mysql sites running very slow on IIS

Posted on 2014-01-23
5
1,967 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 500 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 52

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 82

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Creating and Managing Databases with phpMyAdmin in cPanel.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now