Post Reply 
Commentics making the page really slow?
14-Feb-2012, 11:37 AM
Post: #1
Exclamation Commentics making the page really slow?
Dear Commentics,

Thank you for your great code, however it's drastically slowing down my pages. Any idea what this could be?

Kind Regards,

KKoopman
Find all posts by this user
Quote this message in a reply
14-Feb-2012, 03:28 PM
Post: #2
RE: Commentics making the page really slow?
Hello Klaas, Steven,


is it possible that this causes the slow page load??

[14-Feb-2012 15:15:06] PHP Warning: file_get_contents(http://www.mysite.com/vakantie-frankrijk/ain/) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable
in /home/myserver/domains/mysite.com/public_html/miniblog/comments/includes/functions/page.php on line 73

If so can we get around it.
Find all posts by this user
Quote this message in a reply
14-Feb-2012, 10:26 PM
Post: #3
RE: Commentics making the page really slow?
Hello Steven,

Mailed the ISP on the report error.

Also I checked the fopen like this:

<?
if( ini_get('allow_url_fopen') ) {
echo hello;
}
else {
echo damn the f-open does not work;}
?>

But it seems to work since the output is ... hello.

Found some info on this topic in which is referred to msql server on overload, others talking about clearing server cache and usage of curl.
Checking of the page.php file learns that curl is being used.

Also I have on this server several websites with databases of 20 to 50 mb each outputting 20-50K pages each and they have no trouble. So my guess is that there is something wrong at server level and file get contents / allow url fopen
Find all posts by this user
Quote this message in a reply
15-Feb-2012, 10:18 AM
Post: #4
RE: Commentics making the page really slow?
Tested the server / url again with this:

<?php
$result=file_get_contents("http://www.mysite.com/vakantie-frankrijk/ain/");
if ($result === false)
{
echo false;
} else {
echo true;
}
?>


The return was one time false and one time good.
Find all posts by this user
Quote this message in a reply
15-Feb-2012, 11:08 AM
Post: #5
RE: Commentics making the page really slow?
Been looking at server logs.

If I enable commentics I find apache errors.
As soon as I remove commentics the error logs stay clean.

But the comment and form are shown and also the correct page_id and reference_id are used by the system. So it works, but very slow and with commentics log errors and apache errors.

this is my php include for commentics:


<?php
$page_id = "cmtx_title";
$reference = "cmtx_url";
$path_to_comments_folder = "../miniblog/comments/";
define ('IN_COMMENTICS', 'true'); //no need to edit this line
require $path_to_comments_folder . "includes/commentics.php"; //no need to edit this line
?>


Apache error log:

[Wed Feb 15 11:03:12 2012] [error] mod_hostinglimits:Error on LVE enter: LVE(570) HANDLER(application/x-httpd-php) HOSTNAME(http://www.mysite.nl) URL(/vakantie-frankrijk/regio.php) TID(13233) errno (7)
[Wed Feb 15 11:03:12 2012] [error] [client 222.253.0.23] File does not exist: /home/myserver/domains/mysite.nl/public_html/503.shtml
[Wed Feb 15 11:03:14 2012] [error] [client 111.72.129.127] File does not exist: /home/myserver/domains/mysite.nl/public_html/\\"http:, referer: http://www.mysite.nl/vakantie-frankrijk/ain/
[Wed Feb 15 11:03:14 2012] [error] [client 111.72.129.127] File does not exist: /home/myserver/domains/mysite.nl/public_html/404.shtml, referer: http://www.mysite.nl/vakantie-frankrijk/ain/
[Wed Feb 15 11:03:14 2012] [error] [client 111.72.129.127] File does not exist: /home/myserver/domains/mysite.nl/public_html/\\"http:, referer: http://www.mysite.nl/vakantie-frankrijk/ain/
[Wed Feb 15 11:03:14 2012] [error] [client 111.72.129.127] File does not exist: /home/myserver/domains/mysite.nl/public_html/404.shtml, referer: http://www.mysite.nl/vakantie-frankrijk/ain/
Find all posts by this user
Quote this message in a reply
15-Feb-2012, 12:45 PM
Post: #6
RE: Commentics making the page really slow?
Steven,

If I change the dynamic integration of urls and especially the $page_id = "cmtx_title"; part to the standard example with 1 and page 1. Everything speeds up. Even if I only make the reference dynamic everything is fast.

This is not what I want.

So I have 2 questions: since the ISP is also looking into it:

1. is my usage of de $page_id and $reference correct ??
2. is this being caused on server level or the page.php file aorund the title function lines 65 - 75
3. can possibly an htaccess file be the cause? seems strange since I tested this through removal of commentics script and zero errors on apache level

<?php
$page_id = "cmtx_title";
$reference = "cmtx_url";
$path_to_comments_folder = "../miniblog/comments/";
define ('IN_COMMENTICS', 'true'); //no need to edit this line
require $path_to_comments_folder . "includes/commentics.php"; //no need to edit this line
?>
Find all posts by this user
Quote this message in a reply
16-Feb-2012, 11:05 AM
Post: #7
RE: Commentics making the page really slow?
Hello Steven,

ISP answered, fopen is not open. So the data is gathered as we can see through the curl function.

No answer on way this is causing the slowness from their side.


We will experiment with de page and reference id.
Find all posts by this user
Quote this message in a reply
16-Feb-2012, 03:55 PM
Post: #8
RE: Commentics making the page really slow?
Hi,

Can you try these two solutions:

1.

In comments/includes/functions/page.php, line 83, replace this:
PHP Code:
if (preg_match("/<title>(.+)<\/title>/i"$file$match)) { 

With this:
PHP Code:
if (preg_match("/<title>(.*?)<\/title>/i"$file$match)) { 

2.

In comments/includes/functions/page.php, lines 83 to 89, replace this:
PHP Code:
if (preg_match("/<title>(.+)<\/title>/i"$file$match)) {
    if (
$page_id == "cmtx_title") { $page_id $match[1]; }
    if (
$reference == "cmtx_title") { $reference $match[1]; }
} else {
    if (
$page_id == "cmtx_title") { $page_id "Title not found"; }
    if (
$reference == "cmtx_title") { $reference "Title not found"; }


With this:
PHP Code:
$doc = new DOMDocument();
@
$doc->loadHTML($file);
$nodes $doc->getElementsByTagName('title');
$title $nodes->item(0)->nodeValue;
if (
$page_id == "cmtx_title") { $page_id $title; }
if (
$reference == "cmtx_title") { $reference $title; } 

Have you completed the interview?
Find all posts by this user
Quote this message in a reply
20-Feb-2012, 09:48 AM
Post: #9
RE: Commentics making the page really slow?
Hello Steven,

Thnx for that code, will try it and post results.

And yes, commentics was getting so slow that it took 20-30 seconds before a page was loaded.

At this moment I am including own php variables to get unique storage format in DB / adminpanel and commentics is fast.


By the way it is a super nice comment system.Big Grin
Find all posts by this user
Quote this message in a reply
20-Feb-2012, 04:57 PM
Post: #10
RE: Commentics making the page really slow?
Hi,

Okay I'm glad it's working fast for you now. I look forward to your results.

Have you completed the interview?
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Page id didn't work Koksi 6 587 22-Nov-2012 04:19 PM
Last Post: Koksi
  page loads halfway after submitting comment Edgey 2 330 24-Aug-2012 08:40 PM
Last Post: Edgey
  admin page doesn't log in.... harvard1932 10 771 30-Jul-2012 08:22 PM
Last Post: harvard1932
  random page identification Norbs 4 417 15-May-2012 12:56 PM
Last Post: Steven
  Commentics is running frantically slow littlegeorge 1 340 14-May-2011 06:49 PM
Last Post: Steven
Bug Not reading page with variable in address Static 13 2,237 16-Jul-2010 09:44 PM
Last Post: Static

Forum Jump:


User(s) browsing this thread: 1 Guest(s)