Slow Mysql or PHP

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
AlbinoJellyfish
Forum Commoner
Posts: 76
Joined: Sun Apr 04, 2004 7:39 pm

Slow Mysql or PHP

Post 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>';
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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)?
AlbinoJellyfish
Forum Commoner
Posts: 76
Joined: Sun Apr 04, 2004 7:39 pm

Post 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.
AlbinoJellyfish
Forum Commoner
Posts: 76
Joined: Sun Apr 04, 2004 7:39 pm

Post by AlbinoJellyfish »

Well, tested it on my private server and works fine, and goes speedy. Looks like i just picked a crappy host.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you could potentially Bcc the support team, instead of firing a duplicate email.. that may speed it up a little bit..
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post by liljester »

if i had to bet, id bet that php hangs on the mail() function until the email is sent by sendmail.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

I'd bet that the mail server is down. :P

Since you said it's not even sent.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

To me it seems like dns resolver timeout at mail server.
Post Reply