0

I've been searching around and there are lots of topics on this, but nothing seems to be helping.

I upgraded PHP to 5.5.8 but it was running really slow so I decided to go back to 5.2 and upgrade to 5.3 and increment up incase I was missing something.

PHP 5.3 is running really slow too and I'm unsure where to look. I'm running IIS 7 with Plesk 11.5

In Plesk, there is no option for anything over 5.2 so I'm using IIS to set the PHP version.

PHP is definitely running on 5.3, is working with FastCGI according to PHPINI():

PHP Version 5.3.28
Server API  CGI/FastCGI
_SERVER["REQUEST_URI"]  /phpinfo.php/foobar/?foo=bar
error_log   C:\Windows\Temp\php53-errors.log

Error log is empty.

Basic PHP works fine, but if I try and execute anything to do with database e.g. a simple connect, it runs extremely slowly (works perfect on localhost).

index.php

<?php
ini_set('display_errors', 1);
error_reporting(~0);
echo phpinfo();
function timer()
{
    $time = explode(' ', microtime());
    return $time[0]+$time[1];
}
$beginning = timer();
require("db.php");
?>
<html>
    <!-- The content of your page -->
        Page generated in <?php echo round(timer()-$beginning,6); ?> seconds.
    </body>
</html>

Output: Page generated in 4.001114 seconds.

db.php

<?php
require("config.php");

$dbconn = new PDO('mysql:host='.$db_myHost.';dbname='.$db_myDatabase, $db_myUser, $db_myPassword);

try
   {
   $dbPDO = new PDO('mysql:host='.$db_myHost.';dbname='.$db_myDatabase, $db_myUser, $db_myPassword);
   $dbPDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   }
catch  (PDOException $e)
   {
    //echo "Error!: " . $e->getMessage() . "

    die();
   }

?>

config.php

<?php
//PDO Connection
$db_myHost = "localhost";
$db_myUser = "";
$db_myPassword = "";
$db_myDatabase = "";
?>

Are there any other steps I can try to resolve this issue? I'm up trumps with it, and the server company are reluctant to help as it's out of their area.

ScottC
  • 162
  • 1
  • 14
  • 3
    Try changing the `$db_myHost` variable from 'localhost' to '127.0.0.1' - if the problem is what I suspect it is (it's Windows related) that may well solve it. – CD001 Jan 30 '14 at 11:33
  • I've spent 2 days solid on this! Okay so page now loads in 0.002 seconds. What is the mix up between localhost & NIC? – ScottC Jan 30 '14 at 11:40
  • :) not sure exactly - I ran into the same thing on a Windows dev box a while back; it's not IIS specific, the same happens with Apache/Windows as well when upgrading to PHP 5.3 and above, but it's fine on *nix environments. Oh - and I just found this: http://stackoverflow.com/questions/11663860/mysql-connect-localhost-127-0-0-1-slow-on-windows-platform - probably explains it – CD001 Jan 30 '14 at 11:57
  • Thanks so much! It's the new version doesn't see localhost unless it's specifically looking for it. Will get this changed over. Thanks again! – ScottC Jan 30 '14 at 13:04

0 Answers0