View Single Post
  #4 (permalink)  
Old 06-29-2004, 09:24 PM
cyanide cyanide is offline
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: Toronto, Canada
Posts: 2,193
cyanide RepRank 0
Default

Quote:
Originally Posted by jackson992
My host shut my site off so the server load must have at least been in the 30's. Iuse Php and Mysql thrugh phpadmin

I use this same script for all my datafeed pages with currently around 133,000 indexed in Google right now
I would have shut you down too LOL
By the way, what domain are you runninng this script?

Basically, here's what's happening...
On every page you are making a connection to the database. Apache has a limit to the number of connections you can make server-wide. Each connection you open, uses up precious ram.

So, every time a page is accessed a connection is opened, but when the user leaves the page that connection is left open and idle, meanwhile a new connection is being opened on the next page.

Here's a couple things to try:
1. At the end of the script, put
Code:
mysql_close()
This will close the connection
2. In this code
Code:
$connection=mysql_pconnect($host,$user,$password)
The only difference is I added the p
In this case, you are using a persistent connection. On subsequent pages, the server will look for an existing connection before opening up a new one.
Before you try this second one, you'll have to see if your host supports persistant connections
You can contact them or create a new file and put
Code:
<? phpinfo() ?>
Save the page as phpinfo.php and upload to your root, now navigate to yourdomain.com/phpinfo.php
Do a search for mysql.allow_persistent - to the right of it should say on or off
__________________
|
Web Hosting Guru
| Need Help For Your Forum?
Reply With Quote