php-windows Digest 15 Feb 2003 12:10:25 -0000 Issue 1589
Topics (messages 18543 through 18546):
execute before fopen?
18543 by: Håkan
Re: Interesting problem - PHP 4.3, IIS5, ISAPI
18544 by: Uttam
18545 by: Uttam
PHP - "No input file specified."
18546 by: Craig Smith
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Ok, I came up with a small problem, I have a function that opens and reads
information from xml files, and I have a php file that uses a
system(file.exe -xml) to print the xml code, is there any way to make the
php file execute it and then read the information somehow? I'm kind of
dumbstruck at the moment :)
Håkan
--- End Message ---
--- Begin Message ---
call the stoptiming() function before </HTML> tag, browser may ignore any
text after </HTML> tag.
<?
function startTiming() {
global $startTime;
$microtime = microtime();
$microsecs = substr($microtime, 2, 8);
$secs = substr($microtime, 11);
$startTime = "$secs.$microsecs";
}
function stopTiming() {
global $startTime;
$microtime = microtime();
$microsecs = substr($microtime, 2, 8);
$secs = substr($microtime, 11);
$endTime = "$secs.$microsecs";
echo "<HR>Execution time " . ($endTime - $startTime) . " seconds.";
}
startTiming();
?>
<HTML>
<HEAD>
<TITLE>Stats Server</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<?
$fp = fopen("d:\www\ex030124.log", "r");
$i = 0;
while (!feof($fp)) {
$rowData = fgets($fd);
/*
if(substr($rowData, 1, 1) == "#") {
$iisTitle = preg_split(":", $rowData, "1");
echo $iisTitle . "<BR>";
}
*/
$i++;
//echo $i . "<BR>";
}
stopTiming();
?>
</BODY>
</HTML>
regds,
-----Original Message-----
From: Matt Babineau [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 15, 2003 01:18
To: [EMAIL PROTECTED]
Subject: Interesting problem - PHP 4.3, IIS5, ISAPI
I am trying to output the page runtime to omake a comparison between php
and Coldfusion. I have 2 functions one to start a timer, one to end a
timer.
The php code block in the middle between reads a 140mb file and does
some other stuff. This is fairly unimportant at this point. With the
code block in between the timer functions present, the timer functions
don't output the processing time. When I remove the code block, the
timer functions work great...I don't get it!!
Help!
CODE:
--------------------------
<?
function startTiming() {
global $startTime;
$microtime = microtime();
$microsecs = substr($microtime, 2, 8);
$secs = substr($microtime, 11);
$startTime = "$secs.$microsecs";
}
startTiming();
?>
<HTML>
<HEAD>
<TITLE>Stats Server</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<?
$fp = fopen("d:\www\ex030124.log", "r");
$i = 0;
while (!feof($fp)) {
$rowData = fgets($fd);
/*
if(substr($rowData, 1, 1) == "#") {
$iisTitle = preg_split(":", $rowData, "1");
echo $iisTitle . "<BR>";
}
*/
$i++;
//echo $i . "<BR>";
}
?>
</BODY>
</HTML>
<?
function stopTiming() {
global $startTime;
$microtime = microtime();
$microsecs = substr($microtime, 2, 8);
$secs = substr($microtime, 11);
$endTime = "$secs.$microsecs";
echo "<HR>Execution time " . ($endTime - $startTime) . " seconds.";
}
stopTiming();
?>
--- End Message ---
--- Begin Message ---
also u r using wrong variable $fd in while loop while you have defined $fp,
so this becomes infinite loop. this should give a warning message, if you
have not disabled display of same. check your error logs.
$fp = fopen("d:\www\ex030124.log", "r");
$i = 0;
while (!feof($fp)) {
$rowData = fgets($fd);
/*
if(substr($rowData, 1, 1) == "#") {
$iisTitle = preg_split(":", $rowData, "1");
echo $iisTitle . "<BR>";
}
*/
$i++;
//echo $i . "<BR>";
}
regds,
-----Original Message-----
From: Matt Babineau [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 15, 2003 01:18
To: [EMAIL PROTECTED]
Subject: Interesting problem - PHP 4.3, IIS5, ISAPI
I am trying to output the page runtime to omake a comparison between php
and Coldfusion. I have 2 functions one to start a timer, one to end a
timer.
The php code block in the middle between reads a 140mb file and does
some other stuff. This is fairly unimportant at this point. With the
code block in between the timer functions present, the timer functions
don't output the processing time. When I remove the code block, the
timer functions work great...I don't get it!!
Help!
CODE:
--------------------------
<?
function startTiming() {
global $startTime;
$microtime = microtime();
$microsecs = substr($microtime, 2, 8);
$secs = substr($microtime, 11);
$startTime = "$secs.$microsecs";
}
startTiming();
?>
<HTML>
<HEAD>
<TITLE>Stats Server</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<?
$fp = fopen("d:\www\ex030124.log", "r");
$i = 0;
while (!feof($fp)) {
$rowData = fgets($fd);
/*
if(substr($rowData, 1, 1) == "#") {
$iisTitle = preg_split(":", $rowData, "1");
echo $iisTitle . "<BR>";
}
*/
$i++;
//echo $i . "<BR>";
}
?>
</BODY>
</HTML>
<?
function stopTiming() {
global $startTime;
$microtime = microtime();
$microsecs = substr($microtime, 2, 8);
$secs = substr($microtime, 11);
$endTime = "$secs.$microsecs";
echo "<HR>Execution time " . ($endTime - $startTime) . " seconds.";
}
stopTiming();
?>
--- End Message ---
--- Begin Message ---
When trying to use php script to access records from mysql table getting
following error
"No input file specified."
I am using example php scripts and datatables as defined in the PHP & MySQL
for Dummies Book.
The installation is on a standalone PC and comprises the following
Windows98
Apache 1.3.23
PHP 4.3.0
MySQL 3.23
I know PHP is working through apache as I have used a sample test page which
shows the configuration of PHP as installed. I also believe MySQL is
working as I have been able to apply the same selection SQL via MySQLadmin
as contained in the PHP script I am using to extract records. Below is the
php script I am using:
*********************************************************************
<html>
<head><title>Pet Catalog</title></head>
<body>
<?php
$user="root";
$host="localhost";
$password="password";
$database = "PetCatalog";
$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
$pettype = "horse"; //horse was previously typed in a form by user
$query = "SELECT * FROM Pet WHERE petType='$pettype'";
$result = mysql_query($query)
or die ("Couldn't execute query.");
$nrows = mysql_num_rows($result);
/* Display results in a table */
echo "<h1>Horses</h1>";
echo "<table cellspacing='15'>";
echo "<tr><td colspan='4'><hr></td></tr>";
for ($i=0;$i<$nrows;$i++)
{
$n = $i + 1; //add 1 so that numbers don't start with 0
$row = mysql_fetch_array($result);
extract($row);
$f_price = number_format($price,2);
echo "<tr>\n
<td>$n.</td>\n
<td>$petID</td>\n
<td>$petDescription</td>\n
<td align='right'>\$$f_price</td>\n
</tr>\n";
echo "<tr><td colspan='4'><hr></td></tr>\n";
}
echo "</table>\n";
?>
</body>
</html>
********************************************************************
I think that perhaps the connections are not being made as a simple test I
have deliberately changed the host, database and password to force an error
and this does not happen.
Any help would be appreciated.
Regards
Craig
--- End Message ---