Page 1 of 1

Slow Mysql or PHP

Posted: Mon Jul 19, 2004 11:14 am
by AlbinoJellyfish
Not sure which, but this script runs really slow.

Code: Select all

<?php
echo $_SESSION['info'];
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: ".$_SESSION['name'];
$headers .= "From: SevenGFX <Sales@sevengfx.com>\r\n";
mail("support@sevengfx.com", "New Template Request", $_SESSION['info'],$headers); 
mail($_SESSION['email'], "Your order", $_SESSION['info'],$headers);
$db = mysql_connect("localhost","asdas","asdadfhngds"); 
mysql_select_db("sevengfx_com_-_hosted" , $db) or die("Couldn't open $db: ".mysql_error()); 
$_SESSION['name'] = $name;
$_SESSION['email'] = $email;
$_SESSION['username'] = $username;
$_SESSION['pass'] = $pass;
$sql = "INSERT INTO support_users (name,email,username,password,group_id,admin,level) VALUES ('$name','$email','$username','$pass','2','0','2')";  
$result = mysql_query($sql);
echo 'An email contaning all of your info has been sent to the email you provided.';
echo '<br>You have also been registered at <a href="http://support.sevengfx.com">http://support.sevengfx.com</a>';
?>

Posted: Mon Jul 19, 2004 11:17 am
by feyd
it may be from firing off 2 emails... have you tried testing it with just the email portions, with some prerendered text (that's about the same size you are having problems with)?

Posted: Mon Jul 19, 2004 11:24 am
by AlbinoJellyfish
yes. i think that would be it.

Code: Select all

<?php

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: Matt";
$headers .= "From: SevenGFX <Sales@sevengfx.com>\r\n";
mail("support@sevengfx.com", "New Template Request", 'heloo',$headers); 
mail('mattmooers@mchsi.com', "Your order", 'hello',$headers);

echo 'Whats up?';


?>
Still runs slow, and didnt even send.

Posted: Mon Jul 19, 2004 11:40 am
by AlbinoJellyfish
Well, tested it on my private server and works fine, and goes speedy. Looks like i just picked a crappy host.

Posted: Mon Jul 19, 2004 12:51 pm
by feyd
you could potentially Bcc the support team, instead of firing a duplicate email.. that may speed it up a little bit..

Posted: Mon Jul 19, 2004 2:44 pm
by liljester
if i had to bet, id bet that php hangs on the mail() function until the email is sent by sendmail.

Posted: Mon Jul 19, 2004 4:06 pm
by d3ad1ysp0rk
I'd bet that the mail server is down. :P

Since you said it's not even sent.

Posted: Mon Jul 19, 2004 5:16 pm
by Weirdan
To me it seems like dns resolver timeout at mail server.