473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

popen - command line vs. web server performance

say i have the following two php scripts:

ptest.php:
<?
$p1 = popen("c:\\php\\php -q hello.php","r");
$p2 = popen("c:\\php\\php -q hello.php","r");
while (!feof($p1))
print fgets($p1);
while (!feof($p2))
print fgets($p2);
pclose($p1);
pclose($p2);
?>

and

hello.php:
<?
print "hello,\nworld!\n";
?>

when i run ptest.php via the command line (ie. by typing in c:\php\php
ptest.php at the dos prompt) it runs instantly.

when i run ptest.php via a webserver, the resultant page not only
doesn't even load - it results in a bunch of errors (that appear as
dialogue boxes on the machine doing the hosting) effectively saying
that the command failed to execute properly and will now be shut down.
after clicking through all the errors, the systems performance is
noticebly affected (and in fact is bad enough such that i think a
reboot is justified).

any ideas as to why this is, and what i can do to fix it?
Jul 17 '05 #1
4 3145
yawnmoth wrote:
say i have the following two php scripts:

ptest.php:
<?
$p1 = popen("c:\\php\\php -q hello.php","r");
$p2 = popen("c:\\php\\php -q hello.php","r");
while (!feof($p1))
print fgets($p1);
while (!feof($p2))
print fgets($p2);
pclose($p1);
pclose($p2);


and

hello.php:
<?
print "hello,\nworld!\n";


when i run ptest.php via the command line (ie. by typing in c:\php\php
ptest.php at the dos prompt) it runs instantly.

when i run ptest.php via a webserver, the resultant page not only
doesn't even load - it results in a bunch of errors (that appear as
dialogue boxes on the machine doing the hosting) effectively saying
that the command failed to execute properly and will now be shut down.
after clicking through all the errors, the systems performance is
noticebly affected (and in fact is bad enough such that i think a
reboot is justified).

any ideas as to why this is, and what i can do to fix it?


Did you look at taskmanager to see what causes the poor performance ? Must
be some process hogging the cpu, would help to see if it has to do with
apache (or IIS?) Other than that, is it a typo here or does your hello.php
miss a ? before the end > ???
Jul 17 '05 #2
"Pjotr Wedersteers" <x3****@westerterp.com> wrote in message news:<41***********************@news.xs4all.nl>...
yawnmoth wrote:
say i have the following two php scripts:

ptest.php:
<?
$p1 = popen("c:\\php\\php -q hello.php","r");
$p2 = popen("c:\\php\\php -q hello.php","r");
while (!feof($p1))
print fgets($p1);
while (!feof($p2))
print fgets($p2);
pclose($p1);
pclose($p2);


and

hello.php:
<?
print "hello,\nworld!\n";


when i run ptest.php via the command line (ie. by typing in c:\php\php
ptest.php at the dos prompt) it runs instantly.

when i run ptest.php via a webserver, the resultant page not only
doesn't even load - it results in a bunch of errors (that appear as
dialogue boxes on the machine doing the hosting) effectively saying
that the command failed to execute properly and will now be shut down.
after clicking through all the errors, the systems performance is
noticebly affected (and in fact is bad enough such that i think a
reboot is justified).

any ideas as to why this is, and what i can do to fix it?


Did you look at taskmanager to see what causes the poor performance ? Must
be some process hogging the cpu, would help to see if it has to do with
apache (or IIS?) Other than that, is it a typo here or does your hello.php
miss a ? before the end > ???


yeah - that was a typo. the actual hello.php file has it. anyway,
looking at task manager, i see that a *bunch* of php and cmd processes
are being created, and none are ending. so, what i assume happening
is that the computers memory is just being exhausted.

i tried to replace print "hello,\nworld\n" with
exit("hello,\nworld!\n") to no avail.

the exact error i get is as follows:

The application failed to initialize properly (0xc0000142). Click on
OK to Terminate.

i get that for both php.exe and cmd.exe.

in contrast, when i run it from the command line, it takes place so
fast that i don't see any process being created.
Jul 17 '05 #3
"yawnmoth" <te*******@yahoo.com> wrote in message
news:a0**************************@posting.google.c om...
say i have the following two php scripts:

ptest.php:
<?
$p1 = popen("c:\\php\\php -q hello.php","r");
$p2 = popen("c:\\php\\php -q hello.php","r");
while (!feof($p1))
print fgets($p1);
while (!feof($p2))
print fgets($p2);
pclose($p1);
pclose($p2);
?>

and

hello.php:
<?
print "hello,\nworld!\n";
?>

when i run ptest.php via the command line (ie. by typing in c:\php\php
ptest.php at the dos prompt) it runs instantly.

when i run ptest.php via a webserver, the resultant page not only
doesn't even load - it results in a bunch of errors (that appear as
dialogue boxes on the machine doing the hosting) effectively saying
that the command failed to execute properly and will now be shut down.
after clicking through all the errors, the systems performance is
noticebly affected (and in fact is bad enough such that i think a
reboot is justified).

any ideas as to why this is, and what i can do to fix it?


Could be a DLL incompatibility problem. The DLL search path in Windows, if I
remember correctly, goes like this: the current folder, the folder
containing executable, the system32 folder. If your webserver is running a
different version of PHP than the command line one, then the wrong DLL could
get loaded. Do a search for php4ts.dll and see if there're multiple copies.
Jul 17 '05 #4
On Tue, 12 Oct 2004 01:09:58 -0400, "Chung Leong"
<ch***********@hotmail.com> wrote:
"yawnmoth" <te*******@yahoo.com> wrote in message
news:a0**************************@posting.google. com...
say i have the following two php scripts:

ptest.php:
<?
$p1 = popen("c:\\php\\php -q hello.php","r");
$p2 = popen("c:\\php\\php -q hello.php","r");
while (!feof($p1))
print fgets($p1);
while (!feof($p2))
print fgets($p2);
pclose($p1);
pclose($p2);
?>

and

hello.php:
<?
print "hello,\nworld!\n";
?>

when i run ptest.php via the command line (ie. by typing in c:\php\php
ptest.php at the dos prompt) it runs instantly.

when i run ptest.php via a webserver, the resultant page not only
doesn't even load - it results in a bunch of errors (that appear as
dialogue boxes on the machine doing the hosting) effectively saying
that the command failed to execute properly and will now be shut down.
after clicking through all the errors, the systems performance is
noticebly affected (and in fact is bad enough such that i think a
reboot is justified).

any ideas as to why this is, and what i can do to fix it?


Could be a DLL incompatibility problem. The DLL search path in Windows, if I
remember correctly, goes like this: the current folder, the folder
containing executable, the system32 folder. If your webserver is running a
different version of PHP than the command line one, then the wrong DLL could
get loaded. Do a search for php4ts.dll and see if there're multiple copies.


Thee's only one. I'm actually thinking that this is a bug in PHP. I
was told by my webhost to stop using a similar script because it kept
crashing their browser. Could other people test it out, and post
here, whether or not it works? Also, if it is a bug, how does one go
about filling a bug report?

Jul 17 '05 #5

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

Similar topics

2
by: praba kar | last post by:
Dear All, The following way of popen function usage is wrong or not kindly give me answer regarding this time = os.popen("echo %s | tai64nlocal" % line).read() Actually here I didn't use...
2
by: Ernesto | last post by:
I'm trying to use Popen to do some command line work Windows XP style. I have devcon.exe which I would use on a Windows command line like so: devcon disable...
6
by: Belebele | last post by:
>From an interactive python shell, I execute the following: import os for line in os.popen('alias').readlines(): print line No aliases are printed. I started python from an bash...
4
by: agarwalpiyush | last post by:
Hello, I am going nuts with trying to get the following to work: This is what I intend to do: I have a line in /etc/syslog.conf which I need to delete based on ip-address provided to me in a...
0
by: Alex | last post by:
Hello everyone, I am writing a terminal server client-server application, that offers the client the ability to run commands on the server and read their output. So far everything works...
5
by: nic | last post by:
On my system (WinXP) typing the following line into command prompt(cmd.exe) successfully scans the file test1.txt: "c:\Program Files\Grisoft\AVG Free\avgscan.exe" "c:\program...
12
by: Eric_Dexter | last post by:
I am trying to modify a programming example and I am coming up with two problems... first is that I can't seem to pass along the arguments to the external command (I have been able to do that with...
4
by: zane.selvans | last post by:
Hi there, I've been banging my head against this for a day, and I can't take it anymore. It's probably a stupid error, but I don't see where. I'm trying to use Python to call an external...
0
by: mcoliver | last post by:
I have a python script (script 1) that calls another python script (script 2) which executes a command using os.popen. Everything works flawlessly when executed from the command line. However when...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.