• Resolved aenea

    (@aenea)


    Since I increased the number of links in the Link Library, I am having problems with the Broken Link Checker. It produces the following error message:

    Internal Server Error
    
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    
    Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.
    
    More information about this error may be available in the server error log.

    It works OK on my Test site where I have just 52 links and, originally, it worked OK on the Live site, though with an ocassional occurrence of the above error which I thought could be due to my server being busy. But now I have increased the number of links on the Live site to 87+, I can’t get it to work at all.

    I have WordPress debugging switched on but nothing appears in the debug.log file and I don’t know where else to look for the ‘server error log’.

    Have you any ideas what is going wrong?

    https://www.ads-software.com/plugins/link-library/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter aenea

    (@aenea)

    Any thoughts on this problem (which is still happening)?

    I’ve raised a ticket with my host provider to see if they can track down the appropriate error log but, so far, no response.

    Since it works on my Test site where there are fewer links, it would seem to be something to do with the volume of links to be tested. Is there some way the checking activity could be broken up into smaller segments of, say, 30 links at a time?

    Thread Starter aenea

    (@aenea)

    Here is the reply I just got from my host provider (Namesco):

    If you are receiving a 500 error when running a plugin through WordPress it suggests that the plugin is timing out because the PHP resources it requires to complete the script are being exhausted. We cannot raise PHP features but I can suggest some things which may help you run the script.

    In the Dashboard please try disabling all running plugins apart from the plugin you are referring to, and any sidebar widgets temporarily, and make sure you are currently using a default WordPress theme – then retest.

    If that still doesn’t run then, really, that plugin is more suited to a VPS environment where the php memory can be raised by accessing the php.ini file. We do not provide access to that file on the shared platform I’m afraid.

    Their suggestion that it is timing out sounds plausible. I had a timeout problem with another plugin (Wordfence) until I adjusted a parameter that controls the size of chunks in which they do their checks.

    Can you let me know whether you think you may be able to solve this problem by doing the link checks in batches? Otherwise I will have to look for an alternative method of checking the links.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Yes, it is most likely possible to do this in batches. I just need to find time to figure this out between my day job and paid WordPress development contracts. I will try to get to this by the end of the week.

    Thread Starter aenea

    (@aenea)

    Hi Yannick. Thanks for that. There’s no urgency. I just wanted reassurance that it was on your ToDo list so that I don’t need to put finding an alternative onto mine.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Please try upgrading to the latest version I just released. I have changed the code for the link checker so it outputs data bit by bit to browser instead of processing entire database at once and only sending output at the end.

    Let me know if this does not help and i will research further.

    Please consider donating to support this plugin’s development.

    Thread Starter aenea

    (@aenea)

    Alas! I still get the same error.
    No output appears before the error message.
    I guess it’s difficult for you to pin down the problem unless you can reproduce the fault. If you tell me which source file(s) to look into I could attempt some debugging at my end.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    I have some other ideas. Would you be okay if I make some changes tonight and send to you as a github snippet to upload to your site?

    Thread Starter aenea

    (@aenea)

    Yes. Happy to give that a try tomorrow evening. I haven’t used github before but I’m sure I can manage.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Here is a link to the replacement file:

    https://gist.github.com/ylefebvre/739330017fd83675f12e

    You can use the download zip button to get a zip file containing the replacement link-library-admin.php. Then upload that file to the /wp-content/plugins/link-library directory of your web site via FTP. Or replace the code for that specific file in the plugins editor in the WordPress admin.

    The change that I made here is in the function called ReciprocalLinkChecker, where I added a call to set_time_limit(0), to let it run.

    Let me know if this works.

    Thread Starter aenea

    (@aenea)

    Success! Many thanks.

    Thread Starter aenea

    (@aenea)

    Not sure if there’s anything further you can do on this but, just in case.

    Three of my links failed the broken link check, two with an Error 403 and the third ‘Website Unreachable’. All three links are valid links, however. I suspect this might be the checker timing out before the web site has responded. Here are the links that failed:

    https://www.scottishreviewofbooks.org/
    https://www.theinterpretershouse.com/submissions
    https://www.shanestrachan.com/

    The first two are the Error 403 ones and the third is the unreachable one.

    If there’s not an easy answer to this, don’t bother with it. I will always do a double check on any links that fail the broken link checker.

    Thread Starter aenea

    (@aenea)

    Oops, got one of the links above wrong.
    Should be:
    https://www.theinterpretershouse.com/submissions

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    Try changing line 502 in link-library.php.

    First, try this:
    $response = wp_remote_get( $external_link, array( 'sslverify' => false ) );

    If that does not help, try this:

    $response = wp_remote_get( $external_link, array( 'timeout' => 10 ) );

    You can try increasing the timeout value until you get a valid response. If these help, I can include them in the plugin.

    Please consider donating to support this plugin’s development.

    Thread Starter aenea

    (@aenea)

    Thanks for the suggestions.

    Your first option didn’t help. The second did but, as I increased the timeout I started getting the Internal Server errors again.

    As I investigated things further, it became apparent that your analysis of the response codes from wp_remote_get isn’t sufficient for my purposes. Some of the links that were passing your checks as OK, were actually returning codes 301 (Moved permanently) or 302 (Moved temporarily) both of which require further investigation on my part.
    One of the code 301 sites was actually re-directing to a page that said ‘This web site has been closed’, one of the code 302 sites was re-directing to the wrong page and others were re-directing correctly but, having this information, enables me to update the link to the new URL.

    Also, when the wp_remote_get timed out, your code returned error 403, rather than the fact that it had timed out.

    So, in file link-library-admin.php, when the ReciprocalLinkChecker function is called with $check_type = ‘broken’, I have replaced your call to the CheckReciprocalLink function with a call to a custom function of my own (using curl_exec and curl_getinfo and a CURLOPT_TIMEOUT to prevent Internal Server error when accessing a link takes too long). This function returns both the HTTP code and its meaning and, whenever the code is not equal to 200, I output both code and meaning in the Broken Link Checker Report. This more detailed report alerts me to all the links that need to be checked and then removed or updated.

    So far, this seems to be working well for me. Should you wish, I can provide you with the code of my function and details of the edits I have made to the ReciprocalLinkChecker function.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    The thing about CURL is that I don’t think it is supported on all PHP installations, so I am not sure it would make sense to add this as the primary means to check for broken links.

    Still, it might be interesting to look at your code, if you can send it my way.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Problem with broken link checker’ is closed to new replies.