473,703 Members | 3,969 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

script dies yet there are no errors in error log


Does anything about this script look expensive, in terms of resources or
execution time? This script dies after processing about 20 or 25
numbers, yet it leaves no errors in the error logs. This is on a server
that handles a fairly demanding site. The defaults, in php.ini, have all
been cranked fairly high: scripts get 180 seconds to run, and they can
have as much as 256 megs of RAM.

The input for this script is coming from a textarea in a form, and the
input could not be more simple, just a bunch of UPC codes, one per line:
881034146533x
881034146533xx
881034146533xxx
881034146533xxx x
881034146533xxx xx
881034146533xxx xxx
881034146533xxx xxxx
881034146533xxx xxxxx
881034146533xxx xxxxxx
881034146533xxx xxxxxxx
881034146533xxx xxxxxxxx
881034146533xxx xxxxxxxxx
881034146533xxx xxxxxxxxxx
881034146533xxx xxxxxxxxxxx
881034146533xxx xxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxxx
Given 15 such numbers, the script does fine. But given 200 such numbers,
it dies after processing about 10 numbers.

Supposedly, the code was written many years ago, back in 2002, and yet,
supposedly, the problem with this script (that it dies) only started
recently. Supposedly, no changes were made to the script, it simply
started to die. (Sadly, the code for the site was only recently put into
Subversion, and I only recently joined the project, so I've no way to
evaluate these claims.)
<?
set_time_limit( 0);

require ("include_heade r.php");

$dbh = mysql_pconnect( "xxxxx", "xxxxx", "xxxxx");

mysql_select_db ("alb");

$upc_input = $_POST["upc_input"];

if ($upc_input) {

$pieces = explode("\n", $upc_input);

$count = 0;
$log_file = dirname($_SERVE R["SCRIPT_FILENAM E"]).'/logs/album_removals. log';
$fp = fopen($log_file , 'a+');
while ($upc = $pieces[$count]) {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "Removing UPC/ISRC Code: $upc <br />\n";
$query = "select id from `albums` where UPPER(upc_id) =
'".strtoupper($ upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
// 10-15-08 - this next line makes the assumption that there can
only be
// one record for each UPC. Since I don't know enough to argue, I'll
// assume this must be true for now. I wonder if the import scripts
// enforce uniqueness on the UPC? --LK
$row = mysql_fetch_arr ay($result);
$id = $row["id"];

/* We changed this to status='4' to indicate full removal.
Only values of status='3' will be checked when we run
our go_live.php cronjob to set albums live on certain dates
*/
$query2 = "update albums SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed album status for UPC $id <br />\n";
} else {
// echo "Failed to change album status for UPC $id <br />\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC in
twice? I don't
// want to give a "fail" message. Let's check to see the status.
If it equals 4
// then the record has already been successfully updated. If not,
then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM albums WHERE id='$id' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Album status already updated <br />\n ";
} else {
echo "Failed to change album status for UPC $upc (album $id)
<br />\n ";
}
}

$query3 = "update tracks SET status='4' where album_id=".$id;
$result3 = mysql_query($qu ery3);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed tracks album status for UPC $id <br /><br />\n\n ";
} else {
// echo "Failed to change tracks album status for UPC $id <br
/><br />\n\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC in
twice? I don't
// want to give a "fail" message. Let's check to see the status.
If it equals 4
// then the record has already been successfully updated. If not,
then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM tracks WHERE
album_id='$id' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Track album status already updated <br />\n ";
} else {
echo "Failed to change track album status for UPC $upc (album
$id) <br />\n ";
}
}
} else {
$query = "select id from `tracks` where UPPER(isrc_id) =
'".strtoupper($ upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
$row = mysql_fetch_arr ay($result);
$id = $row["id"];
$query2 = "update tracks SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
echo "Successful ly removed and rebuilt Track Id ".$id;

} else {
echo "Could not find Code as an Album UPC or a Track ISRC";
}

}
echo "<br />";
$count++;
}

fclose($fp);
?>




Oct 20 '08 #1
15 3246
>Does anything about this script look expensive, in terms of resources or
>execution time? This script dies after processing about 20 or 25
numbers, yet it leaves no errors in the error logs. This is on a server
that handles a fairly demanding site. The defaults, in php.ini, have all
been cranked fairly high: scripts get 180 seconds to run, and they can
have as much as 256 megs of RAM.
You leak result sets, maybe 7 per UPC code. I am not sure how
intelligent PHP is in reclaiming result sets when the result is
assigned to the same variable as the last one, and all references
to the old result set are gone. Use of mysql_free_resu lt() is
appropriate when you're through with a result set.

Assuming your result sets only return 1 row, 7*25 result sets
shouldn't come close to running you out of memory. How long does
it take the script to die? 7*25 queries in 180 seconds seems way
slow unless you've got a large table with no useful indexes. You
might, however, be in trouble memory-wise if your queries in fact
return many rows rather than one per query.

What does SHOW CREATE TABLE indicate for the tables involved?
Do they have indexes? On what?

What does the query
select upc_id, count(upc_id) from `albums` group by upc_id;
return? Does it indicate any duplicates?
What does the query
select upc_id, count(upc_id) from `albums` group by upper(upc_id);
return? Does it indicate any duplicates? How long does it take to run?
It might be better to ensure the case of the entries in the database,
(say, with update `albums` set upc_id = UPPER(upc_id); , then make
sure anything later inserted is converted to upper case first,
and change WHERE UPPER(upc_id) = ... to WHERE upc_id = ... .
as it may permit using indexes better.

>The input for this script is coming from a textarea in a form, and the
input could not be more simple, just a bunch of UPC codes, one per line:
881034146533x
881034146533xx
881034146533xxx
881034146533xxx x
881034146533xxx xx
881034146533xxx xxx
881034146533xxx xxxx
881034146533xxx xxxxx
881034146533xxx xxxxxx
881034146533xxx xxxxxxx
881034146533xxx xxxxxxxx
881034146533xxx xxxxxxxxx
881034146533xxx xxxxxxxxxx
881034146533xxx xxxxxxxxxxx
881034146533xxx xxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxxx
Given 15 such numbers, the script does fine. But given 200 such numbers,
it dies after processing about 10 numbers.

Supposedly, the code was written many years ago, back in 2002, and yet,
supposedly, the problem with this script (that it dies) only started
recently. Supposedly, no changes were made to the script, it simply
started to die. (Sadly, the code for the site was only recently put into
Subversion, and I only recently joined the project, so I've no way to
evaluate these claims.)
Did you recently set up the database on a different system, and perhaps
forget to put in the indexes? Could duplicate records be piling up?
>

<?
set_time_limit (0);

require ("include_heade r.php");

$dbh = mysql_pconnect( "xxxxx", "xxxxx", "xxxxx");

mysql_select_d b("alb");

$upc_input = $_POST["upc_input"];

if ($upc_input) {

$pieces = explode("\n", $upc_input);

$count = 0;
$log_file = dirname($_SERVE R["SCRIPT_FILENAM E"]).'/logs/album_removals. log';
$fp = fopen($log_file , 'a+');
while ($upc = $pieces[$count]) {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "Removing UPC/ISRC Code: $upc <br />\n";
$query = "select id from `albums` where UPPER(upc_id) =
'".strtoupper( $upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
// 10-15-08 - this next line makes the assumption that there can
only be
// one record for each UPC. Since I don't know enough to argue, I'll
// assume this must be true for now. I wonder if the import scripts
// enforce uniqueness on the UPC? --LK
$row = mysql_fetch_arr ay($result);
$id = $row["id"];

/* We changed this to status='4' to indicate full removal.
Only values of status='3' will be checked when we run
our go_live.php cronjob to set albums live on certain dates
*/
$query2 = "update albums SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed album status for UPC $id <br />\n";
} else {
// echo "Failed to change album status for UPC $id <br />\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC in
twice? I don't
// want to give a "fail" message. Let's check to see the status.
If it equals 4
// then the record has already been successfully updated. If not,
then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM albums WHERE id='$id' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Album status already updated <br />\n ";
} else {
echo "Failed to change album status for UPC $upc (album $id)
<br />\n ";
}
}

$query3 = "update tracks SET status='4' where album_id=".$id;
$result3 = mysql_query($qu ery3);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed tracks album status for UPC $id <br /><br />\n\n ";
} else {
// echo "Failed to change tracks album status for UPC $id <br
/><br />\n\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC in
twice? I don't
// want to give a "fail" message. Let's check to see the status.
If it equals 4
// then the record has already been successfully updated. If not,
then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM tracks WHERE
album_id='$i d' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Track album status already updated <br />\n ";
} else {
echo "Failed to change track album status for UPC $upc (album
$id) <br />\n ";
}
}
} else {
$query = "select id from `tracks` where UPPER(isrc_id) =
'".strtoupper( $upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
$row = mysql_fetch_arr ay($result);
$id = $row["id"];
$query2 = "update tracks SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
echo "Successful ly removed and rebuilt Track Id ".$id;

} else {
echo "Could not find Code as an Album UPC or a Track ISRC";
}

}
echo "<br />";
$count++;
}

fclose($fp);
?>
Oct 20 '08 #2
Gordon Burditt wrote:
>Does anything about this script look expensive, in terms of resources or
execution time? This script dies after processing about 20 or 25
numbers, yet it leaves no errors in the error logs. This is on a server
that handles a fairly demanding site. The defaults, in php.ini, have all
been cranked fairly high: scripts get 180 seconds to run, and they can
have as much as 256 megs of RAM.

You leak result sets, maybe 7 per UPC code. I am not sure how
intelligent PHP is in reclaiming result sets when the result is
assigned to the same variable as the last one, and all references
to the old result set are gone. Use of mysql_free_resu lt() is
appropriate when you're through with a result set.
Actually, it's quite a bit more than that. mysql_free_resu lt() releases
a little memory in PHP - but also results in a call to MySQL to free
MySQL resources (which can be large).

PHP will reclaim the result set itself when the references are gone, but
it won't free the space in MySQL - that will only happen when the
connection is closed.
Assuming your result sets only return 1 row, 7*25 result sets
shouldn't come close to running you out of memory. How long does
it take the script to die? 7*25 queries in 180 seconds seems way
slow unless you've got a large table with no useful indexes. You
might, however, be in trouble memory-wise if your queries in fact
return many rows rather than one per query.
Agreed. There is another problem here. But the problem may be that
errors are being neither displayed nor logged. The php.ini file should
have:

error_reporting =E_ALL
log_errors=on

If the user wants the PHP errors in a separate file, he should have:

error_log="/path/and/file/name"

Otherwise errors will show up in his Apache error log.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Oct 20 '08 #3
Jerry Stuckle wrote:
Gordon Burditt wrote:
>>Does anything about this script look expensive, in terms of resources
or execution time? This script dies after processing about 20 or 25
numbers, yet it leaves no errors in the error logs. This is on a
server that handles a fairly demanding site. The defaults, in
php.ini, have all been cranked fairly high: scripts get 180 seconds
to run, and they can have as much as 256 megs of RAM.

You leak result sets, maybe 7 per UPC code. I am not sure how
intelligent PHP is in reclaiming result sets when the result is
assigned to the same variable as the last one, and all references
to the old result set are gone. Use of mysql_free_resu lt() is
appropriate when you're through with a result set.

Actually, it's quite a bit more than that. mysql_free_resu lt() releases
a little memory in PHP - but also results in a call to MySQL to free
MySQL resources (which can be large).

PHP will reclaim the result set itself when the references are gone, but
it won't free the space in MySQL - that will only happen when the
connection is closed.
>Assuming your result sets only return 1 row, 7*25 result sets
shouldn't come close to running you out of memory. How long does
it take the script to die? 7*25 queries in 180 seconds seems way
slow unless you've got a large table with no useful indexes. You
might, however, be in trouble memory-wise if your queries in fact
return many rows rather than one per query.

Agreed. There is another problem here. But the problem may be that
errors are being neither displayed nor logged. The php.ini file should
have:

error_reporting =E_ALL
log_errors=on

If the user wants the PHP errors in a separate file, he should have:

error_log="/path/and/file/name"

Otherwise errors will show up in his Apache error log.

It took me awhile to appreciate how stupid this code is, but I finally
realized the whole, long, complicated while() loop could be rewritten
simply:

while ($upc = $pieces[$count]) {
if ($upc != "") {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "Removing UPC/ISRC Code: $upc <br />\n";

$query = "UPDATE albums SET status=4 WHERE UPPER(upc_id) =
'".strtoupper($ upc)."'";
mysql_query($qu ery);

$query = "UPDATE tracks SET status=4 WHERE UPPER(isrc_id) =
'".strtoupper($ upc)."'";
mysql_query($qu ery);

echo "<br />";
$count++;
}
Would you recommend calling mysql_free_resu lt() inside the loop?

Oct 21 '08 #4
Lawrence Krubner wrote:
Jerry Stuckle wrote:
>Gordon Burditt wrote:
>>>Does anything about this script look expensive, in terms of
resources or execution time? This script dies after processing about
20 or 25 numbers, yet it leaves no errors in the error logs. This is
on a server that handles a fairly demanding site. The defaults, in
php.ini, have all been cranked fairly high: scripts get 180 seconds
to run, and they can have as much as 256 megs of RAM.

You leak result sets, maybe 7 per UPC code. I am not sure how
intelligent PHP is in reclaiming result sets when the result is
assigned to the same variable as the last one, and all references
to the old result set are gone. Use of mysql_free_resu lt() is
appropriate when you're through with a result set.

Actually, it's quite a bit more than that. mysql_free_resu lt()
releases a little memory in PHP - but also results in a call to MySQL
to free MySQL resources (which can be large).

PHP will reclaim the result set itself when the references are gone,
but it won't free the space in MySQL - that will only happen when the
connection is closed.
>>Assuming your result sets only return 1 row, 7*25 result sets
shouldn't come close to running you out of memory. How long does
it take the script to die? 7*25 queries in 180 seconds seems way
slow unless you've got a large table with no useful indexes. You
might, however, be in trouble memory-wise if your queries in fact
return many rows rather than one per query.

Agreed. There is another problem here. But the problem may be that
errors are being neither displayed nor logged. The php.ini file
should have:

error_reportin g=E_ALL
log_errors=o n

If the user wants the PHP errors in a separate file, he should have:

error_log="/path/and/file/name"

Otherwise errors will show up in his Apache error log.


It took me awhile to appreciate how stupid this code is, but I finally
realized the whole, long, complicated while() loop could be rewritten
simply:

while ($upc = $pieces[$count]) {
if ($upc != "") {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "Removing UPC/ISRC Code: $upc <br />\n";

$query = "UPDATE albums SET status=4 WHERE UPPER(upc_id) =
'".strtoupper($ upc)."'";
mysql_query($qu ery);

$query = "UPDATE tracks SET status=4 WHERE UPPER(isrc_id) =
'".strtoupper($ upc)."'";
mysql_query($qu ery);

echo "<br />";
$count++;
}
Would you recommend calling mysql_free_resu lt() inside the loop?

mysql_free_resu lt() is only used to release the result object from a
SELECT statement. You do not use it with UPDATE statements.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Oct 21 '08 #5
>It took me awhile to appreciate how stupid this code is, but I finally
>realized the whole, long, complicated while() loop could be rewritten
simply:

while ($upc = $pieces[$count]) {
if ($upc != "") {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "Removing UPC/ISRC Code: $upc <br />\n";

$query = "UPDATE albums SET status=4 WHERE UPPER(upc_id) =
'".strtoupper( $upc)."'";
mysql_query($qu ery);

$query = "UPDATE tracks SET status=4 WHERE UPPER(isrc_id) =
'".strtoupper( $upc)."'";
mysql_query($qu ery);

echo "<br />";
$count++;
}
I still think it would be better to nail down what is in upc_id and
isrc_id (particularly, pick a case and stick to it, using UPPER()
or whatever whenever you insert something into the table), so you
can change:

WHERE UPPER(upc_id) = ...
to
WHERE upc_id = ...

A mass change of the database can be done with:
UPDATE albums set upc_id = UPPER(upc_id);
>Would you recommend calling mysql_free_resu lt() inside the loop?
You don't do any SELECTs which return a result set, so it's not necessary.
Oct 21 '08 #6
Gordon Burditt wrote:
>Does anything about this script look expensive, in terms of resources or
execution time? This script dies after processing about 20 or 25
numbers, yet it leaves no errors in the error logs. This is on a server
that handles a fairly demanding site. The defaults, in php.ini, have all
been cranked fairly high: scripts get 180 seconds to run, and they can
have as much as 256 megs of RAM.

You leak result sets, maybe 7 per UPC code. I am not sure how
intelligent PHP is in reclaiming result sets when the result is
assigned to the same variable as the last one, and all references
to the old result set are gone. Use of mysql_free_resu lt() is
appropriate when you're through with a result set.

Assuming your result sets only return 1 row, 7*25 result sets
shouldn't come close to running you out of memory. How long does
it take the script to die? 7*25 queries in 180 seconds seems way
slow unless you've got a large table with no useful indexes. You
might, however, be in trouble memory-wise if your queries in fact
return many rows rather than one per query.

What does SHOW CREATE TABLE indicate for the tables involved?
Do they have indexes? On what?

What does the query
select upc_id, count(upc_id) from `albums` group by upc_id;
return? Does it indicate any duplicates?
What does the query
select upc_id, count(upc_id) from `albums` group by upper(upc_id);
return? Does it indicate any duplicates? How long does it take to run?
It might be better to ensure the case of the entries in the database,
(say, with update `albums` set upc_id = UPPER(upc_id); , then make
sure anything later inserted is converted to upper case first,
and change WHERE UPPER(upc_id) = ... to WHERE upc_id = ... .
as it may permit using indexes better.

Do the indexes slow down UPDATEs?

When I attempt to input 200 UPCs, I don't even get a PHP error, instead
I get this error:

"OK

The server encountered an internal error or misconfiguratio n and was
unable to complete your request.

Please contact the server administrator and inform them of the time the
error occurred, and anything you might have done that may have caused
the error.

More information about this error may be available in the server error log.
Apache/2.2.3 (CentOS) Port 443"
As I mentioned before, no errors show up in PHP error log.
If I run the "top" command while this script is executing, I see stuff
like this:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
24689 apache 18 0 14572 6312 2152 S 1 0.3 1:30.32 php
25296 apache 15 0 14976 7704 3244 S 1 0.4 4:51.05 php
29271 apache 15 0 34068 12m 4052 S 0 0.6 0:00.59 httpd
29368 root 15 0 2304 1064 792 R 0 0.1 0:00.38 top
1 root 15 0 2040 544 520 S 0 0.0 0:27.96 init
Though, the database is actually on a separate server. I suppose I
should run top on that server too.

Script works if I run this against just 5 or 10 UPCs, though the script
is insanely slow. This is true even if I run it against UPCs that I
myself have come up with, and which I'm sure are unique in the database.
I've simplified the code down to this :

if ($upc_input) {
$startTime = microtime();
echo "<p>Start time: $startTime </p>";

$upc_input = trim($upc_input );
$pieces = explode("\n", $upc_input);

$log_file =
dirname($_SERVE R["SCRIPT_FILENAM E"]).'/logs/album_removals. log';
$fp = fopen($log_file , 'a+');

$numberOfUpcs = count($pieces);
echo " <p>You entered $numberOfUpcs UPCs</p\n ";

for ($i=0; $i < $numberOfUpcs; $i++) {
$upc = $pieces[$i];

// 10-20-08 see comment above to see why empty string is dangerous
- returns 10,147 rows!
if ($upc != "") {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "<br /\n <br /\n Removing UPC/ISRC Code: $upc ";

$query = "UPDATE albums SET status=4 WHERE UPPER(upc_id) =
'".strtoupper($ upc)."'";
$result = mysql_query($qu ery);
echo "<br /\n albums updated: " . mysql_affected_ rows();

$query = "UPDATE tracks SET status=4 WHERE UPPER(isrc_id) =
'".strtoupper($ upc)."'";
$result = mysql_query($qu ery);
echo "<br /\n tracks updated: " . mysql_affected_ rows();
}
echo "<br />";
} // ends for() loop

fclose($fp);
$endTime = microtime();
echo "<p>End time: $endTime </p>";

$totalTime = $endTime - $startTime;
$totalTime = round($totalTim e / 1000, 2);
echo "The total time for this script was $totalTime seconds";
}



>
>The input for this script is coming from a textarea in a form, and the
input could not be more simple, just a bunch of UPC codes, one per line:
881034146533x
881034146533xx
881034146533xxx
881034146533xxx x
881034146533xxx xx
881034146533xxx xxx
881034146533xxx xxxx
881034146533xxx xxxxx
881034146533xxx xxxxxx
881034146533xxx xxxxxxx
881034146533xxx xxxxxxxx
881034146533xxx xxxxxxxxx
881034146533xxx xxxxxxxxxx
881034146533xxx xxxxxxxxxxx
881034146533xxx xxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxxx
Given 15 such numbers, the script does fine. But given 200 such numbers,
it dies after processing about 10 numbers.

Supposedly, the code was written many years ago, back in 2002, and yet,
supposedly, the problem with this script (that it dies) only started
recently. Supposedly, no changes were made to the script, it simply
started to die. (Sadly, the code for the site was only recently put into
Subversion, and I only recently joined the project, so I've no way to
evaluate these claims.)

Did you recently set up the database on a different system, and perhaps
forget to put in the indexes? Could duplicate records be piling up?
>>
<?
set_time_limit (0);

require ("include_heade r.php");

$dbh = mysql_pconnect( "xxxxx", "xxxxx", "xxxxx");

mysql_select_d b("alb");

$upc_input = $_POST["upc_input"];

if ($upc_input) {

$pieces = explode("\n", $upc_input);

$count = 0;
$log_file = dirname($_SERVE R["SCRIPT_FILENAM E"]).'/logs/album_removals. log';
$fp = fopen($log_file , 'a+');
while ($upc = $pieces[$count]) {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "Removing UPC/ISRC Code: $upc <br />\n";
$query = "select id from `albums` where UPPER(upc_id) =
'".strtoupper( $upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
// 10-15-08 - this next line makes the assumption that there can
only be
// one record for each UPC. Since I don't know enough to argue, I'll
// assume this must be true for now. I wonder if the import scripts
// enforce uniqueness on the UPC? --LK
$row = mysql_fetch_arr ay($result);
$id = $row["id"];

/* We changed this to status='4' to indicate full removal.
Only values of status='3' will be checked when we run
our go_live.php cronjob to set albums live on certain dates
*/
$query2 = "update albums SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed album status for UPC $id <br />\n";
} else {
// echo "Failed to change album status for UPC $id <br />\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC in
twice? I don't
// want to give a "fail" message. Let's check to see the status.
If it equals 4
// then the record has already been successfully updated. If not,
then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM albums WHERE id='$id' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Album status already updated <br />\n ";
} else {
echo "Failed to change album status for UPC $upc (album $id)
<br />\n ";
}
}

$query3 = "update tracks SET status='4' where album_id=".$id;
$result3 = mysql_query($qu ery3);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed tracks album status for UPC $id <br /><br />\n\n ";
} else {
// echo "Failed to change tracks album status for UPC $id <br
/><br />\n\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC in
twice? I don't
// want to give a "fail" message. Let's check to see the status.
If it equals 4
// then the record has already been successfully updated. If not,
then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM tracks WHERE
album_id='$i d' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Track album status already updated <br />\n ";
} else {
echo "Failed to change track album status for UPC $upc (album
$id) <br />\n ";
}
}
} else {
$query = "select id from `tracks` where UPPER(isrc_id) =
'".strtoupper( $upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
$row = mysql_fetch_arr ay($result);
$id = $row["id"];
$query2 = "update tracks SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
echo "Successful ly removed and rebuilt Track Id ".$id;

} else {
echo "Could not find Code as an Album UPC or a Track ISRC";
}

}
echo "<br />";
$count++;
}

fclose($fp);
?>
Oct 21 '08 #7
Gordon Burditt wrote:
>Does anything about this script look expensive, in terms of resources or
execution time? This script dies after processing about 20 or 25
numbers, yet it leaves no errors in the error logs. This is on a server
that handles a fairly demanding site. The defaults, in php.ini, have all
been cranked fairly high: scripts get 180 seconds to run, and they can
have as much as 256 megs of RAM.

You leak result sets, maybe 7 per UPC code. I am not sure how
intelligent PHP is in reclaiming result sets when the result is
assigned to the same variable as the last one, and all references
to the old result set are gone. Use of mysql_free_resu lt() is
appropriate when you're through with a result set.

Assuming your result sets only return 1 row, 7*25 result sets
shouldn't come close to running you out of memory. How long does
it take the script to die? 7*25 queries in 180 seconds seems way
slow unless you've got a large table with no useful indexes. You
might, however, be in trouble memory-wise if your queries in fact
return many rows rather than one per query.

What does SHOW CREATE TABLE indicate for the tables involved?
Do they have indexes? On what?

What does the query
select upc_id, count(upc_id) from `albums` group by upc_id;
return? Does it indicate any duplicates?
What does the query
select upc_id, count(upc_id) from `albums` group by upper(upc_id);
return? Does it indicate any duplicates? How long does it take to run?
It might be better to ensure the case of the entries in the database,
(say, with update `albums` set upc_id = UPPER(upc_id); , then make
sure anything later inserted is converted to upper case first,
and change WHERE UPPER(upc_id) = ... to WHERE upc_id = ... .
as it may permit using indexes better.

Thanks for you tips.

The code is going slowly. I added microtime() to the beginning and end
of the script. It would appear that when I input just 3 UPCs, the script
takes 3 tenths of a second to complete.

Start time: 0.34472400 1224561376

You entered 3 UPCs
Removing UPC/ISRC Code: xxxxxxxxxxxx829 881594865884489 4
albums updated: 1
tracks updated: 0
Removing UPC/ISRC Code: xxxxxxxxxxxx331 342923453273154 6
albums updated: 1
tracks updated: 0
Removing UPC/ISRC Code: xxxxxxxxxxxx575 133967761191433 3
albums updated: 1
tracks updated: 0

End time: 0.64086300 1224561455





>The input for this script is coming from a textarea in a form, and the
input could not be more simple, just a bunch of UPC codes, one per line:
881034146533x
881034146533xx
881034146533xxx
881034146533xxx x
881034146533xxx xx
881034146533xxx xxx
881034146533xxx xxxx
881034146533xxx xxxxx
881034146533xxx xxxxxx
881034146533xxx xxxxxxx
881034146533xxx xxxxxxxx
881034146533xxx xxxxxxxxx
881034146533xxx xxxxxxxxxx
881034146533xxx xxxxxxxxxxx
881034146533xxx xxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxxx
Given 15 such numbers, the script does fine. But given 200 such numbers,
it dies after processing about 10 numbers.

Supposedly, the code was written many years ago, back in 2002, and yet,
supposedly, the problem with this script (that it dies) only started
recently. Supposedly, no changes were made to the script, it simply
started to die. (Sadly, the code for the site was only recently put into
Subversion, and I only recently joined the project, so I've no way to
evaluate these claims.)

Did you recently set up the database on a different system, and perhaps
forget to put in the indexes? Could duplicate records be piling up?
>>
<?
set_time_limit (0);

require ("include_heade r.php");

$dbh = mysql_pconnect( "xxxxx", "xxxxx", "xxxxx");

mysql_select_d b("alb");

$upc_input = $_POST["upc_input"];

if ($upc_input) {

$pieces = explode("\n", $upc_input);

$count = 0;
$log_file = dirname($_SERVE R["SCRIPT_FILENAM E"]).'/logs/album_removals. log';
$fp = fopen($log_file , 'a+');
while ($upc = $pieces[$count]) {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "Removing UPC/ISRC Code: $upc <br />\n";
$query = "select id from `albums` where UPPER(upc_id) =
'".strtoupper( $upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
// 10-15-08 - this next line makes the assumption that there can
only be
// one record for each UPC. Since I don't know enough to argue, I'll
// assume this must be true for now. I wonder if the import scripts
// enforce uniqueness on the UPC? --LK
$row = mysql_fetch_arr ay($result);
$id = $row["id"];

/* We changed this to status='4' to indicate full removal.
Only values of status='3' will be checked when we run
our go_live.php cronjob to set albums live on certain dates
*/
$query2 = "update albums SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed album status for UPC $id <br />\n";
} else {
// echo "Failed to change album status for UPC $id <br />\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC in
twice? I don't
// want to give a "fail" message. Let's check to see the status.
If it equals 4
// then the record has already been successfully updated. If not,
then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM albums WHERE id='$id' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Album status already updated <br />\n ";
} else {
echo "Failed to change album status for UPC $upc (album $id)
<br />\n ";
}
}

$query3 = "update tracks SET status='4' where album_id=".$id;
$result3 = mysql_query($qu ery3);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed tracks album status for UPC $id <br /><br />\n\n ";
} else {
// echo "Failed to change tracks album status for UPC $id <br
/><br />\n\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC in
twice? I don't
// want to give a "fail" message. Let's check to see the status.
If it equals 4
// then the record has already been successfully updated. If not,
then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM tracks WHERE
album_id='$i d' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Track album status already updated <br />\n ";
} else {
echo "Failed to change track album status for UPC $upc (album
$id) <br />\n ";
}
}
} else {
$query = "select id from `tracks` where UPPER(isrc_id) =
'".strtoupper( $upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
$row = mysql_fetch_arr ay($result);
$id = $row["id"];
$query2 = "update tracks SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
echo "Successful ly removed and rebuilt Track Id ".$id;

} else {
echo "Could not find Code as an Album UPC or a Track ISRC";
}

}
echo "<br />";
$count++;
}

fclose($fp);
?>
Oct 21 '08 #8
On Oct 20, 10:28*pm, Lawrence Krubner <lawre...@krubn er.comwrote:
Jerry Stuckle wrote:
Gordon Burditt wrote:
>Does anything about this script look expensive, in terms of resources
or execution time? This script dies after processing about 20 or 25
numbers, yet it leaves no errors in the error logs. This is on a
server that handles a fairly demanding site. The defaults, in
php.ini, have all been cranked fairly high: scripts get 180 seconds
to run, and they can have as much as 256 megs of RAM.
You leak result sets, maybe 7 per UPC code. *I am not sure how
intelligent PHP is in reclaiming result sets when the result is
assigned to the same variable as the last one, and all references
to the old result set are gone. *Use of mysql_free_resu lt() is
appropriate when you're through with a result set.
Actually, it's quite a bit more than that. *mysql_free_res ult() releases
a little memory in PHP - but also results in a call to MySQL to free
MySQL resources (which can be large).
PHP will reclaim the result set itself when the references are gone, but
it won't free the space in MySQL - that will only happen when the
connection is closed.
Assuming your result sets only return 1 row, 7*25 result sets
shouldn't come close to running you out of memory. *How long does
it take the script to die? *7*25 queries in 180 seconds seems way
slow unless you've got a large table with no useful indexes. *You
might, however, be in trouble memory-wise if your queries in fact
return many rows rather than one per query.
Agreed. *There is another problem here. *But the problem may be that
errors are being neither displayed nor logged. *The php.ini file should
have:
error_reporting =E_ALL
log_errors=on
If the user wants the PHP errors in a separate file, he should have:
error_log="/path/and/file/name"
Otherwise errors will show up in his Apache error log.

It took me awhile to appreciate how stupid this code is, but I finally
realized the whole, long, complicated while() loop could be rewritten
simply:

while ($upc = $pieces[$count]) {
* *if ($upc != "") {
* * * *$upc = trim($upc);
* * * *fwrite($fp, $upc."\n");
* * * *echo "Removing UPC/ISRC Code: $upc *<br />\n";

* * * *$query = "UPDATE albums SET status=4 WHERE UPPER(upc_id) =
'".strtoupper($ upc)."'";
* * * *mysql_query($q uery);

* * * *$query = "UPDATE tracks SET status=4 WHERE UPPER(isrc_id) =
'".strtoupper($ upc)."'";
* * * *mysql_query($q uery);

* * *echo "<br />";
* * *$count++;

}

Would you recommend calling mysql_free_resu lt() *inside the loop?- Hidequoted text -

- Show quoted text -
Shouldn't this:

while ($upc = $pieces[$count])

be:

while ($upc == $pieces[$count])

?

It seems in the former you are assiging the value of $pieces[$count]
to $upc, not comparing as you are in the later, or does PHP do things
differently in the while loop than Perl, C, Javascript, Actionscript
etc?

Bill H
Oct 21 '08 #9
Lawrence Krubner wrote:
Gordon Burditt wrote:
>>Does anything about this script look expensive, in terms of resources
or execution time? This script dies after processing about 20 or 25
numbers, yet it leaves no errors in the error logs. This is on a
server that handles a fairly demanding site. The defaults, in
php.ini, have all been cranked fairly high: scripts get 180 seconds
to run, and they can have as much as 256 megs of RAM.

You leak result sets, maybe 7 per UPC code. I am not sure how
intelligent PHP is in reclaiming result sets when the result is
assigned to the same variable as the last one, and all references
to the old result set are gone. Use of mysql_free_resu lt() is
appropriate when you're through with a result set.

Assuming your result sets only return 1 row, 7*25 result sets
shouldn't come close to running you out of memory. How long does
it take the script to die? 7*25 queries in 180 seconds seems way
slow unless you've got a large table with no useful indexes. You
might, however, be in trouble memory-wise if your queries in fact
return many rows rather than one per query.

What does SHOW CREATE TABLE indicate for the tables involved?
Do they have indexes? On what?

What does the query select upc_id, count(upc_id) from `albums`
group by upc_id;
return? Does it indicate any duplicates?
What does the query
select upc_id, count(upc_id) from `albums` group by upper(upc_id);
return? Does it indicate any duplicates? How long does it take to run?
It might be better to ensure the case of the entries in the database,
(say, with update `albums` set upc_id = UPPER(upc_id); , then make
sure anything later inserted is converted to upper case first,
and change WHERE UPPER(upc_id) = ... to WHERE upc_id = ... .
as it may permit using indexes better.


Do the indexes slow down UPDATEs?

When I attempt to input 200 UPCs, I don't even get a PHP error, instead
I get this error:

"OK

The server encountered an internal error or misconfiguratio n and was
unable to complete your request.

Please contact the server administrator and inform them of the time the
error occurred, and anything you might have done that may have caused
the error.

More information about this error may be available in the server error log.
Apache/2.2.3 (CentOS) Port 443"
As I mentioned before, no errors show up in PHP error log.
If I run the "top" command while this script is executing, I see stuff
like this:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
24689 apache 18 0 14572 6312 2152 S 1 0.3 1:30.32 php
25296 apache 15 0 14976 7704 3244 S 1 0.4 4:51.05 php
29271 apache 15 0 34068 12m 4052 S 0 0.6 0:00.59 httpd
29368 root 15 0 2304 1064 792 R 0 0.1 0:00.38 top
1 root 15 0 2040 544 520 S 0 0.0 0:27.96 init
Though, the database is actually on a separate server. I suppose I
should run top on that server too.

Script works if I run this against just 5 or 10 UPCs, though the script
is insanely slow. This is true even if I run it against UPCs that I
myself have come up with, and which I'm sure are unique in the database.
I've simplified the code down to this :

if ($upc_input) {
$startTime = microtime();
echo "<p>Start time: $startTime </p>";

$upc_input = trim($upc_input );
$pieces = explode("\n", $upc_input);

$log_file =
dirname($_SERVE R["SCRIPT_FILENAM E"]).'/logs/album_removals. log';
$fp = fopen($log_file , 'a+');

$numberOfUpcs = count($pieces);
echo " <p>You entered $numberOfUpcs UPCs</p\n ";

for ($i=0; $i < $numberOfUpcs; $i++) {
$upc = $pieces[$i];

// 10-20-08 see comment above to see why empty string is dangerous -
returns 10,147 rows!
if ($upc != "") {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "<br /\n <br /\n Removing UPC/ISRC Code: $upc ";

$query = "UPDATE albums SET status=4 WHERE UPPER(upc_id) =
'".strtoupper($ upc)."'";
$result = mysql_query($qu ery);
echo "<br /\n albums updated: " . mysql_affected_ rows();

$query = "UPDATE tracks SET status=4 WHERE UPPER(isrc_id) =
'".strtoupper($ upc)."'";
$result = mysql_query($qu ery);
echo "<br /\n tracks updated: " . mysql_affected_ rows();
}
echo "<br />";
} // ends for() loop

fclose($fp);
$endTime = microtime();
echo "<p>End time: $endTime </p>";

$totalTime = $endTime - $startTime;
$totalTime = round($totalTim e / 1000, 2);
echo "The total time for this script was $totalTime seconds";
}



>>
>>The input for this script is coming from a textarea in a form, and
the input could not be more simple, just a bunch of UPC codes, one
per line:
881034146533x
881034146533xx
881034146533xxx
881034146533xxx x
881034146533xxx xx
881034146533xxx xxx
881034146533xxx xxxx
881034146533xxx xxxxx
881034146533xxx xxxxxx
881034146533xxx xxxxxxx
881034146533xxx xxxxxxxx
881034146533xxx xxxxxxxxx
881034146533xxx xxxxxxxxxx
881034146533xxx xxxxxxxxxxx
881034146533xxx xxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxx
881034146533xxx xxxxxxxxxxxxxxx
Given 15 such numbers, the script does fine. But given 200 such
numbers, it dies after processing about 10 numbers.

Supposedly, the code was written many years ago, back in 2002, and
yet, supposedly, the problem with this script (that it dies) only
started recently. Supposedly, no changes were made to the script, it
simply started to die. (Sadly, the code for the site was only
recently put into Subversion, and I only recently joined the project,
so I've no way to evaluate these claims.)

Did you recently set up the database on a different system, and perhaps
forget to put in the indexes? Could duplicate records be piling up?
>>>
<?
set_time_limi t(0);

require ("include_heade r.php");

$dbh = mysql_pconnect( "xxxxx", "xxxxx", "xxxxx");

mysql_select_ db("alb");

$upc_input = $_POST["upc_input"];

if ($upc_input) {

$pieces = explode("\n", $upc_input);

$count = 0;
$log_file =
dirname($_SER VER["SCRIPT_FILENAM E"]).'/logs/album_removals. log';
$fp = fopen($log_file , 'a+');
while ($upc = $pieces[$count]) {
$upc = trim($upc);
fwrite($fp, $upc."\n");
echo "Removing UPC/ISRC Code: $upc <br />\n";
$query = "select id from `albums` where UPPER(upc_id) =
'".strtoupper ($upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
// 10-15-08 - this next line makes the assumption that there can
only be
// one record for each UPC. Since I don't know enough to argue, I'll
// assume this must be true for now. I wonder if the import scripts
// enforce uniqueness on the UPC? --LK
$row = mysql_fetch_arr ay($result);
$id = $row["id"];

/* We changed this to status='4' to indicate full removal.
Only values of status='3' will be checked when we run
our go_live.php cronjob to set albums live on certain dates
*/
$query2 = "update albums SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed album status for UPC $id <br />\n";
} else {
// echo "Failed to change album status for UPC $id <br />\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC
in twice? I don't
// want to give a "fail" message. Let's check to see the
status. If it equals 4
// then the record has already been successfully updated. If
not, then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM albums WHERE id='$id' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Album status already updated <br />\n ";
} else {
echo "Failed to change album status for UPC $upc (album $id)
<br />\n ";
}
}

$query3 = "update tracks SET status='4' where album_id=".$id;
$result3 = mysql_query($qu ery3);
$numUpdated = mysql_affected_ rows($dbh);
if ($numUpdated) {
echo "Changed tracks album status for UPC $id <br /><br
/>\n\n ";
} else {
// echo "Failed to change tracks album status for UPC $id <br
/><br />\n\n ";
//
// 10-15-08 - what happens when some staffer puts the same UPC
in twice? I don't
// want to give a "fail" message. Let's check to see the
status. If it equals 4
// then the record has already been successfully updated. If
not, then we can
// give a fail message.
$queryStatusChe ck = "SELECT status FROM tracks WHERE
album_id='$id ' ";
$resultStatusCh eck = mysql_query($qu eryStatusCheck) ;
$rowStatusCheck = mysql_fetch_ass oc($resultStatu sCheck);
$status = $rowStatusCheck["status"];
if ($status == 4) {
echo "Track album status already updated <br />\n ";
} else {
echo "Failed to change track album status for UPC $upc (album
$id) <br />\n ";
}
}
} else {
$query = "select id from `tracks` where UPPER(isrc_id) =
'".strtoupper ($upc)."'";
$result = mysql_query($qu ery);

if (mysql_num_rows ($result)) {
$row = mysql_fetch_arr ay($result);
$id = $row["id"];
$query2 = "update tracks SET status='4' where id=".$id;
$result2 = mysql_query($qu ery2);
echo "Successful ly removed and rebuilt Track Id ".$id;
} else {
echo "Could not find Code as an Album UPC or a Track ISRC";
}

}
echo "<br />";
$count++;
}

fclose($fp) ;
?>
Yes, indexes slow down updates, but not that much.

Look at the message again. It says the server error log, not the php
error log (which you may or may not even have configured).

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Oct 21 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2108
by: Robert Rozman | last post by:
Hi, I'm total php newbie and probably have trivial problem. I have following two scripts. First creates web form and should run second script with two arguments. But those two arguments don't get to second script, cause this line print "Please enter both phone number and name!";
11
2260
by: mikey_boy | last post by:
Hello! Curious if anyone could give me a hand. I wrote this PHP script with makes a simple connection to a mysql database called firstdb and just pulls back the results and displays on the webpage. Here is the script. I appreciate any light that could be shed on the script and why I would get the errors. Thank you,
0
1350
by: Jerry Negrelli | last post by:
I have a windows service that is mysteriously dying on me at what appears to be random intervals. Sometimes its 3 hours, sometimes it's 2 days. Clearly an error is occuring but I haven't been able to pinpoint the problem The service's OnStart method initializes an object whose constructor creates a thread that launches other threads based on certain DB criteria. Every method I call starts with a try and ends with a catch, and any errors...
17
7921
by: comp.lang.tcl | last post by:
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php" requires user input to run; this causes the TCL script calling the PHP script to hose up and die. Is there a way I can do this so that the TCL script can call the PHP
6
2807
by: comp.lang.php | last post by:
PHP version 4.3.9 GD version 2.0.2 Whenever I use imagecreatefromjpeg(), PHP completely dies. No errors, no warnings, no notices, it dies in the following manner: If using Firefox it just stops running cold If using Konqueror you get the message "An error occurred while processing http://www.blah.com/tools/app"
9
3816
by: jehugaleahsa | last post by:
Hello: I am working on a service. For the past month we have been simply restarting the service daily (which defeats the point). I have been putting some extra time into it today and have come to the conclusion that a pop-up window is trying to open whenever an error occurs. However, the line of code that it dies on is inside of a try/catch. I
3
1688
by: John Kotuby | last post by:
Hey guys, In IE7 where I am tesing my Web Apps written with VB in VS 2005 I have set the IE option: "Display Notification of all script errors" to be active. Now that I have changed some asp:links to asp:linkbuttons, I am getting notification of script errors whereas before on the same page I wasn't. It has to be the Javascript DoPost with options that ASP.NET is generating, I
3
4511
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude error-trapping (if it finds an error in one of the xml files, the script stops). Recently, the script has stopped working because one of the xml files is badly formed. So I decided to rewrite the script with better error trapping; the script should...
1
47468
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8672
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9123
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6594
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5923
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4434
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2462
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.