View Full Version : delay/lag caused by PHP
Flash Gordon
05-26-2005, 03:20 AM
I recently changed the formats of a friends webpage to use PHP instead of just html. But i have noticed up to a 3 second delay before the page loads. This is really unacceptable. I understand the server has to interpret the PHP before it sends the page but come on, I can do math faster than that. Here is the NEW (http://#/) verision and here is the OLD (http://#) if you would like to see the lag/delay in action. The ONLY difference between the pages is the following PHP code
<?php
$months = array("january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december");
$date = date(n);
$arrayMonth = $date - 1;
$currentMonth = $months[$arrayMonth] . ".php";
?>
<map name="hello" border="0">
<area shape="rect" coords="240,136,312,156" alt="projects" href=" <?php print "http://www.mysite.com/~folder/$currentMonth" ?>">
</map>
mmm..pi..3.14..
05-26-2005, 03:47 AM
just a thought, but try using fopen(), fread(), and echo() to display the page. Read the text in the html page, then store the data as a variable, then echo() the value of that variable to create the page...make sense?
Flash Gordon
05-26-2005, 04:22 AM
fopen() lets you read/write to a file
fread() lets you read a file, and
echo() is similar to print except for it is a "tad" faster.
here is a side note:
jml(at)fervorstudios.com
03-May-2005 04:24
Be very careful if fread() accepts user input. Even if you're just using it for URLs, a user could view the contents of any file on your site or even server, depending on how it's set up. All they have to do is put in a valid filename (ie - "./index.php"). If you're allowing user input, you should AT LEAST verify that is_file() returns false before you display the contents to the user.
I'm a little slow, so are you suggesting, I use fopen() or fread() to open $currentMonth? Then echo() the page?
Thanks for the help.
Flash Gordon
05-27-2005, 05:37 AM
I actually haven't changed anything yet, but it seems to be running faster now. Is it possible my stupid server was just running its PHP slow that day?
Flash Gordon
05-31-2005, 07:05 AM
Okay different problem still caused by PHP i think
Using IE click HERE (http://www.modernmusicians.com/daneffland/recordings.php)
Then click on the flash pic once it displayes. Notice the image on the left gets cut in half. Hit refresh and it comes back. What the devil is going on here? PHP is causing way too many problems.
mmm..pi..3.14..
05-31-2005, 05:14 PM
the image isn't getting cut in half over here. I used IE and Firefox, both worked perfectly :D
Flash Gordon
05-31-2005, 05:29 PM
ok thanks...web stuff is so confusing. Nothing seems to ever go as planned. :rolleyes: or work the same way twice.
Flash Gordon
05-31-2005, 07:25 PM
now it is doing it in random places, especially in the "itinerary" area and changing the months.The image on the right the bottom gets cut off. What the foo-dinkle? :mad:
Does anyone have any idea why it would be doing this?
mmm..pi..3.14..
05-31-2005, 08:14 PM
don't see anything wrong with it :confused: Looks perfect on my side, in both browsers. I even browsed to every page too, still nothing wrong with it.
Eric
Flash Gordon
05-31-2005, 09:04 PM
Kool. thanks Eric for all the help. :)
I'm trying to fix all the validation problems to see if that will help.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.