Gossamer Forum
Home : General : Internet Technologies :

Browser Overload

Quote Reply
Browser Overload
Hi,
I'm not sure if this is a Perl, Apache, MySQL, DBManSQL or Internet Explorer problem so I'm going to post it here and see what happens.

I have a perl script (DBManSQL) that does the following -
1/ Searches a MySQL database based on html form input.
2/ Based on the above search it then performs about 4 additional queries on different MySQL tables for each of the results in 1/ above and additional data is gathered (using a seperate plugin).
3/ All of the data (original result plus additional data) is combined and the final html code is generated by looping through the hits.
4/ The final html code is returned to the browser.

If there are only one or two hits in the original search, the final result is displayed in my browser as it should be. The problem is when there are more results, my browser just gives up (blank page) after a few seconds or I get the "page can't be displayed" message.
It seems to depend on the amount and type of html code being returned. For example, if there are too many links or table rows it causes the problem. If I comment out some of the perl code so it doesn't generate so much code it seem to work.
I'm running everything locally so it's not my internet connection or web hosting service.

Does anyone have any ideas what might be causing or contributing to this problem? Why doesn't my browser wait for everything to come through?

My specs are as follows -
Pentium 4 - 2.26GHZ with 1GB RAM
Win XP / Apache 2 / ActivePerl-5.8 / mysql-4
Internet Explorer 6


Thank you.
Quote Reply
Re: [jai] Browser Overload In reply to
Sounds more like Perl is either crashing, or just shutting down. What do you see if running it via SSH? I've had cases of "out of memory" being the problem (not physical memory, but just the memory available to the user that is running the script).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Browser Overload In reply to
In Reply To:
What do you see if running it via SSH?
Sorry, I'm not sure what you mean? Thanks
Quote Reply
Re: [jai] Browser Overload In reply to
secure shell... basicly an encrypted variant of telnet.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [jai] Browser Overload In reply to
Is this script running locally, or on a remote web-server?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Browser Overload In reply to
In Reply To:
Is this script running locally, or on a remote web-server?


It's running locally - http//127.0.0.1/path
Thanks for your help.
Quote Reply
Re: [jai] Browser Overload In reply to
Try running it via DOS if you have the right setup.

Code:
chdir c:/file/path/to/script
perl script_name.cgi

What does that give you?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Browser Overload In reply to
What's the command line format for including values after the script name?

e.g perl script_name.cgi?db=dbname

I need to parse in a value to get the script going.

Thank you.

Last edited by:

jai: Apr 5, 2004, 5:08 PM
Quote Reply
Re: [jai] Browser Overload In reply to
I would normally use Getopt::Long;

Code:
use Getopt::Long;
my ($action,$group);
GetOptions ('action=s' => \$action,'group=s' => \$group);

You can then pass it in like;

perl scriptname.cgi --action=1234 --group=20

Hope that helps :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Browser Overload In reply to
In Reply To:
I would normally use Getopt::Long;

Code:
use Getopt::Long;
my ($action,$group);
GetOptions ('action=s' => \$action,'group=s' => \$group);

You can then pass it in like;

perl scriptname.cgi --action=1234 --group=20


Ok, I have modified your example a bit to suite my situation -

use Getopt::Long;
my ($db);
GetOptions ('db=s' => \$db);


And I inserted it into my script.

When I try the following I don't get the desired result -

perl scriptname.cgi --db=nameofdatabase

Do I need to enclose the db value in quotes or something???

Why doesn't it work?

I actually managed to execute the first part of the script by setting a default table in my DBManSQL admin but I would still like to know why the above doesn't work.

Also, When I ran my script at the command line it displayed all the html. How do I continue through each action in my script? Can I input field values or something as if I was using my browser? If so, How do I do it at the command line? The problem (as described at the begging of this thread) requires me to enter search criteria, how would I do that at the command line.

Thank you.
Quote Reply
Re: [jai] Browser Overload In reply to
I'm getting there (slowly).
I read the following -
http://www.perldoc.com/...lib/Getopt/Long.html
It appears that what I was trying should work -
perl scriptname.cgi --db=nameofdatabase
Any ideas why it's not working?
I'm trying to achieve the command line equiverlant of -
http://127.0.0.1/...gi?db=nameofdatabase

When we use the command line do we need to use the leading "?" and "&" between values that we want to parse?

Once I get it to work I should be able to parse in ALL the fields for my search the same way and see what is happening with my script.

Any ideas?
Thank you.

Last edited by:

jai: Apr 6, 2004, 4:58 PM
Quote Reply
Re: [jai] Browser Overload In reply to
Ok, I did it without Getopt.
It apears that CGI.pm can read params from the command line

perl scriptname.cgi db=database do=search_results keyword=* Username=username Password=password

I'm going to test it a few times then post my results so we can get back to my browser problem.

I would still be interested in the Getopt method for future reference if someone know the answers to my last questions.
Thank you.


Quote Reply
Re: [jai] Browser Overload In reply to
Hi,

If it's one of our newer products (any of the SQL ones), you can do:

./script.cgi 'query_string'

and it will run it with those args. i.e.:

./script.cgi 'db=foo&do=search-results'

Handy for cutting and pasting a query string and trying something from shell.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [jai] Browser Overload In reply to
Thanks for all your help.

Now, back to the topic of this thread (Browser Overload).

I tested my script from the command line and it is doing everything it should and there are no errors in the Apache logs. The database queries and the html are being generated without any problems. I even added a couple of lines to print to a file to check what was being sent and that works as well.
The problem arises when the html is printed to the browser.
My browser either doesn't respond or the html is returned slightly corrupted.

It appears to be an Apache problem or something with my browser. Can I rule out Perl and MySQL now or is there something else I can check?

Any ideas on how to continue from here?
What should I do next?
Thank you.

Quote Reply
Re: [jai] Browser Overload In reply to
I just loaded everything onto my (remote) web hosting server and everything seems to be working ok.
So I guess the problem is with my local Apache 2 setup.
It works ok on the command line but not in my browser on my localhost.
Any other ideas what may be causing this problem.
Thank you.