Jump to content


Very slow remotely included php functions

  • Please log in to reply
2 replies to this topic

#1 Auriga

  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 27 October 2006 - 06:54 AM

Hi there!

I have a VPS containing some domains of mine. Each domain will only be able to see it's own dedicated space (folders) on the server.  Also, each will get some data from a central database using a php file that contains the queries. This database is located on a dedicated domain, and cannot be directly polled by any of the other domains. This because the database is too large to be copied to every domain.

To get text from the database (poll the database), i use a script located on that central domain (with the database). This PHP script is called as follows:

print include($PATH_TO_CENTRAL_FILE.'?param=$param');

$param will give the necessary information to the database (will be put in the query) to get the data from it. The data that the file gets from the database will be send back to the resp. webpage and printed there.

When i ran the webpage on the domain, i noticed that it's very slow. Now I ran the linux command ab (Apache Benchmarking) on this webpage. Here are the results for different scenarios:

Without database polling, without the include (the file at $PATH_TO_CENTRAL_FILE is not used at all in the webpage):

137.36 #/sec

The file will only return text, no database polling (no queries run on the database):

0.73 #/sec

The file will poll the database, but not return any results (the webpage gets an empty string):

0.96 #/sec

The file will poll the database and send the results to the webpage (normal scenario):

0.79 #/sec

It appears that whenever I send data back from an included PHP file, the webpage gets incredibly slow. Notice that the webpage still is very slow if i do not poll the database (no query is executed)! (?!)

Therefore, I think it has something to do with the way that inclusions of different (absolute) paths are handled by PHP versus calling a procedure inline your html code. If you include a file using

print include(http://www.mydomain....?params=$params);

seems to be a lot slower than

and then call
print myFunctionInFile($params);

with afile.php in the same folder as the webpage.

Do I make any sense at all? And if so, does anybody know a way to speed things up?

Thanks in advance!

#2 redarrow

  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 27 October 2006 - 07:08 AM


Wish i new all about php DAM i will have to learn

#3 Auriga

  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 27 October 2006 - 08:04 PM

Thank you for your suggestions! However it didn't work... It's still as slow as before... Any other suggestions?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users