Webmaster Forum

Go Back   Webmaster Forum > Web Development > Web Hosting Forum

Web Hosting Forum Discuss web hosting related stuff.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 09-26-2012, 10:02 AM
Aekii Aekii is offline
Junior Member
 
Join Date: 09-26-12
Posts: 3
iTrader: 0 / 0%
Slow server, please can you help me?

Hi, I have a problem with a server, I'm going to explain it.

I have a PHP page which query a Mysql database and a Postgre database. I've put in the page a simple PHP script which give me loading page time. Let's assume it is 10 seconds.

When I'm going to click on a button to go to this page, if I count the number of seconds it takes to load, I count 15 seconds.

Why there is these difference? What's the cause?

There is something I can do with PHP in order to reduce those 5 seconds?

The page is on a https server.

Any help appreciated, many thanks.

Aeki
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 09-26-2012, 10:21 AM
J. H. Rasmussen J. H. Rasmussen is online now
Super Moderator
 
Join Date: 11-11-11
Location: Copenhagen, Denmark
Posts: 5,993
iTrader: 1 / 100%
If you measure the time by adding some php-code to the script, then only the time it takes to execute the script will be measured, if you test by clicking on a link, then there is access time, load time, time for php to return the output to the server, and the server to send that output to the web client involved etc.

PHP execution time, depends on how effective the php-code is. Posting the code in v7ns coding forum, and ask for help to make it more efficient might be a good way to go about this.
 
Reply With Quote
  #3  
Old 09-26-2012, 10:29 AM
Aekii Aekii is offline
Junior Member
 
Join Date: 09-26-12
Posts: 3
iTrader: 0 / 0%
Hi Rasmussen, thanks for your reply.
I cannot post the code in the forum as it is copyrighted.
Anyway, I measure PHP load time by adding as soon as after <body> the variable $time , then as soon as befose </body> the variable $time1 , then I make the difference between $time1 and $time , which return me the complete execution time for that page.

I assume it is correct, isn't it?

What I also ask to myself (and to the forum) is: as I don't have direct control to the server, is there something I can do by using PHP to increase other-than-php variables response time?

I don't think so but I would like to ask for confirmation.

Hope I've well explained my problem.
 
Reply With Quote
  #4  
Old 09-26-2012, 10:48 AM
J. H. Rasmussen J. H. Rasmussen is online now
Super Moderator
 
Join Date: 11-11-11
Location: Copenhagen, Denmark
Posts: 5,993
iTrader: 1 / 100%
Quote:
Originally Posted by Aekii View Post
Hi Rasmussen, thanks for your reply.
I cannot post the code in the forum as it is copyrighted.
Anyway, I measure PHP load time by adding as soon as after <body> the variable $time , then as soon as befose </body> the variable $time1 , then I make the difference between $time1 and $time , which return me the complete execution time for that page.

I assume it is correct, isn't it?
You should place the start code as the first line of code (if posible) in your php-script, don't be to concerned about the correct placment in the (x)html, the end-code should be the last code line. It's not correct (x)html, since the execution time will be outputed after </html>, but the important thing with mesuring time is to mesure the time of posible all the code on the page, not just the code between <body> and </body>. When you have mesured the time, remove the code you use to mesure time with or disable it somehow.
 
Reply With Quote
  #5  
Old 09-27-2012, 07:35 AM
Aekii Aekii is offline
Junior Member
 
Join Date: 09-26-12
Posts: 3
iTrader: 0 / 0%
Quote:
Originally Posted by Natcoweb. View Post
Have you already solved your issue?
Not yet...
 
Reply With Quote
  #6  
Old 10-01-2012, 11:13 AM
JonaHost.com JonaHost.com is offline
Junior Member
 
Join Date: 10-01-12
Posts: 4
iTrader: 0 / 0%
Try adding GZIP compression to your web site.
This can be added into the .htaccess file to reduce load times.
 
Reply With Quote
  #7  
Old 10-03-2012, 04:53 AM
alemcherry alemcherry is offline
Contributing Member
 
Join Date: 07-19-06
Posts: 711
iTrader: 0 / 0%
The time given by your php code is the execution time and the time you count is execution time + time to transfer the data between your system and the server. So the total time depends on the connection speed as well.

I would say 10 seconds execution is too much for any sort of PHP pages, the ideal time taken should be anything between 0.1 seconds to 0.3 seconds. You obviously need to optimize the PHP / MySQL and bring the execution time under 1 second. It is also possible that your server is too slow and if so you need to find a better hosting.

Run any standard PHP scripts on your server man measure the time. If they take more than 1 sec. you are probably on a slow server.
 
Reply With Quote
  #8  
Old 10-05-2012, 06:09 AM
numaniaw numaniaw is offline
Banned
 
Join Date: 07-05-12
Posts: 90
iTrader: 0 / 0%
Quote:
Originally Posted by Aekii View Post
Hi, I have a problem with a server, I'm going to explain it.

I have a PHP page which query a Mysql database and a Postgre database. I've put in the page a simple PHP script which give me loading page time. Let's assume it is 10 seconds.

When I'm going to click on a button to go to this page, if I count the number of seconds it takes to load, I count 15 seconds.

Why there is these difference? What's the cause?

There is something I can do with PHP in order to reduce those 5 seconds?

The page is on a https server.

Any help appreciated, many thanks.

Aeki
You can ask your hosting provider to increase max_execution time limit in your custom php.ini file, but the main reason is that the server you are located on is experiencing constant overloads. Try to ask your provider to transfer your account to a different server. It can be so that your current server is overcrowded with customers and if they transfer your account to a newer server, the speed of your scripts may become better.

Last edited by HTMLBasicTutor; 10-05-2012 at 10:32 AM.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Hosting Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shifting Servers From USA Shared Server to Canada VPS Server will affect SEO Rankings technousaseo Google Forum 4 03-31-2012 09:52 PM
(???) Couldn't connect to sql server 2000 using xampp server on windows server 64 bit flyingman Coding Forum 11 06-24-2008 11:31 AM
Server beach! too slow to respond! ramanean Dedicated Servers 4 08-14-2007 04:56 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 06:21 AM.
Powered by vBulletin
Copyright © 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC