Jump to content

Script Processing time issues


dflow

Recommended Posts

hi

 

i have a script that does the follow:

presents html

saves the html to a folder and renames the file

 

now the file is only 70kb max

the problem i have is that i get a server problem 500, my hosting says that the script takes to long

i went over the script with a programmer  friend of mine and it is fine.

 

we thought maybe the time it takes from time a request is sent to the time it reaches the server is too long

 

i work a lot from coffee places with wifi my the internet connections?

 

you thoughts and advise

 

thanks

Link to comment
Share on other sites

the script:

<?php require_once('../Connections/international.php'); ?>
<?php
$colname_RsProductProposed = "1";
if (isset($HTTP_GET_VARS['PID'])) {
  $colname_RsProductProposed = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['PID'] : addslashes($HTTP_GET_VARS['PID']);
}
mysql_select_db($database_international, $international);
$query_RsProductProposed = sprintf("SELECT * FROM products WHERE ProductID = %s", $colname_RsProductProposed);
$RsProductProposed = mysql_query($query_RsProductProposed, $international) or die(mysql_error());
$row_RsProductProposed = mysql_fetch_assoc($RsProductProposed);
$totalRows_RsProductProposed = mysql_num_rows($RsProductProposed);
?>
<?php
$colname_RsServiceVoucher = "1";
if (isset($HTTP_GET_VARS['RID'])) {
  $colname_RsServiceVoucher = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['RID'] : addslashes($HTTP_GET_VARS['RID']);
}
mysql_select_db($database_international, $international);
$query_RsServiceVoucher = sprintf("SELECT * FROM contact_form WHERE RequestID = %s", $colname_RsServiceVoucher);
$RsServiceVoucher = mysql_query($query_RsServiceVoucher, $international) or die(mysql_error());
$row_RsServiceVoucher = mysql_fetch_assoc($RsServiceVoucher);
$totalRows_RsServiceVoucher = mysql_num_rows($RsServiceVoucher);

$colname_RsSupplierInfo = "1";
if (isset($HTTP_GET_VARS['SupID'])) {
  $colname_RsSupplierInfo = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['SupID'] : addslashes($HTTP_GET_VARS['SupID']);
}
mysql_select_db($database_international, $international);
$query_RsSupplierInfo = sprintf("SELECT * FROM suppliers WHERE SupplierID = %s", $colname_RsSupplierInfo);
$RsSupplierInfo = mysql_query($query_RsSupplierInfo, $international) or die(mysql_error());
$row_RsSupplierInfo = mysql_fetch_assoc($RsSupplierInfo);
$totalRows_RsSupplierInfo = mysql_num_rows($RsSupplierInfo);
?>
<html>
<head>
<title>Service Voucher and Reservation/Booking Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" link="#666666" vlink="#333333" alink="#999999">
<table width="600" border="0" cellspacing="10" cellpadding="0" align="center">
  <tr> 
    <td><img src="http://mysite.com/images/logo_143_59.gif"></td>
  </tr>
  <tr> 
    <td></td>
  </tr>
  <tr> 
    <td><div align="center"><font size="2" face="Arial, Helvetica, sans-serif">Tel: 
         e-mail: <b>info@mysite.com</b></font></div></td>
  </tr>
  <tr> 
    <td height="2" bgcolor="#CCCCCC"><font face="Arial, Helvetica, sans-serif"> </font></td>
  </tr>
  <tr> 
    <td> <p align="left" style="font-family:verdana, arial,sans-serif;font-size:10pt;text-align:center;margin-top:0"><font face="Arial, Helvetica, sans-serif"><b>CONFIRMATION 
        VOUCHER - RESERVATION/BOOKING NUMBER - <font size="2"><?php echo $row_RsServiceVoucher['SupplierBookingReferrence']; ?><br>
        </font></b></font></td>
  </tr>
  <tr> 
    <td><div align="center"><font face="Arial, Helvetica, sans-serif"><b><font size="2">Date<?php echo $row_RsServiceVoucher['timestamp']; ?> mysite Reservation Number 1458<?php echo $row_RsServiceVoucher['RequestID']; ?>x4rvs</font></b></font></div></td>
  </tr>
  <tr> 
    <td> <table width="580" border="0" cellspacing="1" cellpadding="3">
        <tr valign="top" bgcolor="#3399FF"> 
          <td width="153" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"> 
              First Name: </td>
          <td width="424" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"><font size="2" face="Arial, Helvetica, sans-serif"><?php echo $row_RsServiceVoucher['CustomerFirstName']; ?></font></p></td>
        </tr>
        <tr valign="top" bgcolor="#3399FF"> 
          <td width="153" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0">Last 
              Name: </td>
          <td width="424" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"><font size="2" face="Arial, Helvetica, sans-serif"><?php echo $row_RsServiceVoucher['CustomerLastName']; ?></font></p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td width="153" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0">Arrival 
              Date: </td>
          <td width="424" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"><font face="Arial, Helvetica, sans-serif"><b><?php echo $row_RsServiceVoucher['DepartureDate']; ?></b></font></p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td width="153" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0">Departure 
              Date: </td>
          <td width="424" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"><font face="Arial, Helvetica, sans-serif"><b><?php echo $row_RsServiceVoucher['ReturnDate']; ?></b></font></p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td width="153" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0">Number 
              of Nights: </td>
          <td width="424" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"><font face="Arial, Helvetica, sans-serif"><b><?php echo $row_RsServiceVoucher['num_nights']; ?></b></font></p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td height="20"><font size="2">Adults / Children</font></td>
          <td height="20"><p><font face="Arial, Helvetica, sans-serif"><strong><font size="2"><?php echo $row_RsServiceVoucher['TotalNumberAdults']; ?>/<?php echo $row_RsServiceVoucher['TotalNumberChildren']; ?></font></strong></font></p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td colspan=2> <TABLE width=100% border=1 cellspacing=0 cellpadding=0 align='center'>
              <TR> 
                <TD height=20><B> <p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'>Apartment 
                    / Service</TD>
                <TD align=center><B> <p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'>Date 
                    From</TD>
                <TD align=center><B> <p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'>Date 
                    To</TD>
                <TD  align=center><B> <p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'>No.of 
                    Nights</TD>
                <TD align=center><B> <p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'>No 
                    Of People</TD>
                <TD align=right><B> <p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'> 
                    Payment on Site</TD>
              </TR>
              <TR> 
                <TD height=20><p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'><?php echo $row_RsServiceVoucher['ProductID']; ?></TD>
                <TD align=center><p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'><b><?php echo $row_RsServiceVoucher['DepartureDate']; ?></b></TD>
                <TD align=center><p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'><b><?php echo $row_RsServiceVoucher['ReturnDate']; ?></b></TD>
                <TD align=center><p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'><b><?php echo $row_RsServiceVoucher['num_nights']; ?></b></TD>
                <TD align=center><p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'><?php echo $row_RsServiceVoucher['TotalNumber']; ?></TD>
                <TD  align=right><p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'><?php echo $row_RsServiceVoucher['PAYTOSUPPLIER']; ?>
                    <?php /*START_PHP_SIRFCIT*/ if ($row_RsProductProposed['CountryID']!="100"){ ?>
                    &#8364; 
                    <?php } /*END_PHP_SIRFCIT*/ ?>
                    <?php /*START_PHP_SIRFCIT*/ if ($row_RsProductProposed['CountryID']=="100"){ ?>
                    $
                    <?php } /*END_PHP_SIRFCIT*/ ?>
                  </TD>
              </TR>
              <TR valign="top"> 
                <TD height=20 colspan="6"><p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'><strong>APARTMENT 
                    ADDRESS:</strong></TD>
              </TR>
              <TR valign="top"> 
                <TD height=20 colspan="6"><B> <p style='font-family:verdana, arial,sans-serif;font-size:8pt;margin-top:0'><?php echo $row_RsProductProposed['ProductAddress']; ?></TD>
              </TR>
            </TABLE></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td width="153" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0">Remainder 
              due :</td>
          <td width="424" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"><font face="Arial, Helvetica, sans-serif"><?php echo $row_RsServiceVoucher['PAYTOSUPPLIER']; ?>
              <?php /*START_PHP_SIRFCIT*/ if ($row_RsProductProposed['CountryID']!="100"){ ?>
              &#8364; 
              <?php } /*END_PHP_SIRFCIT*/ ?>
              <?php /*START_PHP_SIRFCIT*/ if ($row_RsProductProposed['CountryID']=="100"){ ?>
              $ 
              <?php } /*END_PHP_SIRFCIT*/ ?>
              </font></p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td height="20" colspan=2> <p style="font-family:verdana, arial,sans-serif;font-size:6pt;text-align:center;margin-top:0">  
        <tr bgcolor="#3399FF"> 
          <td height="20" colspan="2"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0">Contact 
              Person Details: <?php echo $row_RsSupplierInfo['KeysContactPersonName']; ?> 
              <?php echo $row_RsProductProposed['ProductOwnerInfo']; ?>
          <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"> </p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td height="20" colspan="2" valign="top"><p>Mobile:<?php echo $row_RsSupplierInfo['KeysContactPersonMobile']; ?><?php echo $row_RsProductProposed['ProductOwneMobile']; ?><br>
              <br>
            </p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td height="20" colspan="2"><p>Fixed Tel: <?php echo $row_RsSupplierInfo['SupplierFixedTelephoneNumber']; ?><?php echo $row_RsProductProposed['ProductOwnerPhone']; ?></p></td>
        </tr>
        <tr bgcolor="#3399FF"> 
          <td height="20" colspan="2"> <form action="" method="get">
              <input name="LN" type="hidden" value="<?php echo $row_RsServiceVoucher['CustomerLastName']; ?>">
              <input name="RID" type="hidden" id="RID" value="<?php echo $row_RsServiceVoucher['RequestID']; ?>">
              <input name="PID" type="hidden" id="PID" value="<?php echo $row_RsServiceVoucher['ProductID']; ?>">
              <input name="SupID" type="hidden" id="SupID" value="<?php echo $row_RsServiceVoucher['SupplierID']; ?>">
            </form></td>
        </tr>
        <!--End-->
        <tr bgcolor="#3399FF"> 
          <td height="20" colspan=2> <p style="font-family:verdana, arial,sans-serif;font-size:6pt;text-align:center;margin-top:0">  
        <tr bgcolor="#3399FF"> 
          <td width="153" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"> </td>
          <td width="424" height="20"> <p style="font-family:verdana, arial,sans-serif;font-size:8pt;text-align:left;margin-top:0"><font face="Arial, Helvetica, sans-serif"></font></p></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td height="3" bgcolor="#CCCCCC"></td>
  </tr>
  <tr> 
    <td height="3" bgcolor="#CCCCCC"></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($RsServiceVoucher);

mysql_free_result($RsSupplierInfo);
?>

<?php
//url vars:
$urlRID = $_GET['RID'];
$urlSupID = $_GET['SupID'];
$urlPID = $_GET['PID'];

$urlpar = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

// get url content
$url_contents ="http://mysite:mysitebo@$urlpar ";

$query_file_content = file_get_contents($url_contents, "r") or die("cannot open url");

// save results to a local file
// depending on how your server is configured you may need to give queryfiles folder 777 permission
// file rename
$filenameSV = 'SV_';
$filenameLN = $_GET['LN'];
$filenameRID = $_GET['RID'];
$filetype = '.htm';


$file = fopen('../backoffice/createdfiles/'.$filenameSV.''.$filenameLN.'_'.$filenameRID.''.$filetype.'', 'w+');

fwrite ($file, $query_file_content);

fclose($file);


?>

Link to comment
Share on other sites

  • 2 months later...

hi this script is taking too long on my hosting server

I get 500 server error

the script should show a preview of a form and then save to a folder as a HTML file

 

is the script too complex? or do I need a new dedicated hosting to control server timeouts?

Link to comment
Share on other sites

server problem 500 is nothing to do with timeout (at least not according to any web server that conforms to RFC 2616

408 is a server timeout, 504 a gateway timeout.

 

500 is most commonly because there is an error in your script that prevents it from running at all, a fatal error.

Try doing a php -l against the script to identify the problem... and against any included files as well

Link to comment
Share on other sites

server problem 500 is nothing to do with timeout (at least not according to any web server that conforms to RFC 2616

408 is a server timeout, 504 a gateway timeout.

 

If PHP exceeds the max execution time it will result in a fatal error. Fatal errors mean a 500 error when PHP is running as CGI or FastCGI.

 

 

dflow, check the error logs, they'll say which error caused the 500.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.