WordPress.org

Ready to get started?Download WordPress

Forums

errors when leaving comments (29 posts)

  1. inthepink
    Member
    Posted 9 years ago #

    I've had several people let me know that they get the following error when leaving comments:

    Error: This file cannot be used on its own.

    The site is: http://www.inthepinktexas.com

    In the two cases where I know the browser - it was firefox.

    I have not been able to replicate the issue in firefox or IE. the people having problems have sometimes been able to post a comment if someone else already has.

    any ideas? I couldn't find anything in older posts or on the web - except one issue related to pop-up comments.

    thank you.

  2. callamonster
    Member
    Posted 9 years ago #

    i don't know how to help but i'm having the same problem! did you find anything out? someone help us please :)

  3. callamonster
    Member
    Posted 9 years ago #

    i found the text, but i don't know what this means-

    <?php
    if (!$_SERVER['HTTP_REFERER'] == dirname(__FILE__) . '/wp-comments.php')
    {
    die ('Error: This file cannot be used on its own.');
    }
    /* Don't remove these lines. */
    $blog = 1;
    require ('wp-blog-header.php');
    add_filter('comment_text', 'popuplinks');
    foreach ($posts as $post) { start_wp();
    ?>

  4. LunarPowered
    Member
    Posted 9 years ago #

    I am having the same problem on WordPress 1.5.

    "Error: This file cannot be used on its own."

  5. pericat
    Member
    Posted 9 years ago #

    Just left a comment with the pink blog as a test. No error. Also with Jons Blog. No error there, either. :( Sorry, guys.

  6. LunarPowered
    Member
    Posted 9 years ago #

    Yeah, we can't recreate the errors because it's only coming from SOME people. but thanks for the help.

  7. tcpayne
    Member
    Posted 9 years ago #

    I'm seeing this error as well on the fiancee's blog at http://www.believemagic.com/journal. I get the error in IE6 SP2 under Windows XP SP2 on two different PCs (one is an actual PC, the other is a Virtual PC under MacOS X). The fiancee also gets the error from work under Win2k in IE5.5 (she thinks that's the IE version, anyway). And one of her users mentioned it to her, which is how we found out in the first place (unknown OS and browser).

    Safari 1.2.4, FireFox 1.0, and IE 5.2 on the Mac exhibit no problems. Similarly, FireFox 1.1 on the PC has no problems. But every time I try to click on any comment link in IE6 in XP, I get the "error: file cannot be used on its own" message. This includes posts that already have a comment or two posted, FWIW.

    Is there a recent update to IE for the PC that would cause pop-up comments to go AFU? A security setting, perhaps?

    I'll have access to a few more machines at the university tomorrow - I'll see if I get the error from there as well.

    Troy

  8. TabooPrincess
    Member
    Posted 9 years ago #

    I only get the error when I try to post comments to other friends WP blogs that are a newer version. I have an older version of WP and have no problems commenting and no one has ever told me that they get that error. I have tried numerous friends blogs in numerous browsers and get that blasted error message and it is driving me insane quite frankly.

    Jessica

  9. tcpayne
    Member
    Posted 9 years ago #

    I have been able to narrow this down a bit. I should say from the start that I know nothing of PHP and very little about HTML... but working from the code around the error message:

    if (!$_SERVER['HTTP_REFERER'] == dirname(__FILE__) . '/wp-comments.php')

    I figured that the referer request header might be involved here.

    In Opera you can easily enable/disable sending that header. With the referer header enabled, I get no error message. With the header disabled, I get the error every time. Tested in Opera v8.0 on the Mac and v7.54 on Windows.

    I'd love it if others could reproduce that result, just to make sure it's nothing wacky on my end.

    Using the steps outlined at http://codex.wordpress.org/Enable_Sending_Referrers however, does not eliminate the error in IE6 for Windows. The Windows machines are running XP SP2 and there's no security software - even the Windows firewall is disabled.

    Any ideas from the gurus? I can't figure out how to enable sending the referer in IE.

    Troy

  10. billyum
    Member
    Posted 9 years ago #

    Any ideas anyone? One of my friends is getting the same error.

    So far I've gotten that this is a problem with the referer header. Is it located in the popup comments file? If so... why is the error showing up for regular comments (no popup)?

  11. tcpayne
    Member
    Posted 9 years ago #

    I'm only seeing the issue when popup comments are enabled. With popup comments commented out, there's no problem. That's been the temporary fix for the fiancee's blog (disable popup comments) since I can't very well tell her users they must use Opera.

    So what would happen if I just commented out these lines in wp-comments-popup.php:

    if (!$_SERVER['HTTP_REFERER'] == dirname(__FILE__) . '/wp-comments.php')
    {
    die ('Error: This file cannot be used on its own.');
    }

    As I said before, I know precisely jack about PHP. What's the purpose for these lines? Is using the referer header merely an anti-spam device, or does it serve a larger purpose? Is the error message really caused by the referer header being not present (or malformed somehow) or does it just look that way?

    The same lines appear in wp-comments-post.php... would I have to remove them from there as well?

    More to the point, will I be crushed by a huge foot (Monty Python animation-style) if I just sorta remove those lines and see what happens?

    Troy

  12. Henson123
    Member
    Posted 9 years ago #

    Hey, there.

    One of my important visitors had this same problem with the "Error: This file cannot be used on its own." We spent days trying to get around it and nothing seemed to work.

    Finally, we attempted to post after SHUTTING DOWN NORTON ANTI-VIRUS. It worked like a charm. Now, this is not, in any way, a permanent fix, but it does give us the next step to investigate. Is there something is anti-virus software that causes referer headers to be sent or not? I'd like to find out so I can ensure ease of use for my site. Every visitor is precious, you know. Feel free to stop by and take a looksie yourself.

    http://www.keithatkeith.com

  13. stonegauge
    Member
    Posted 9 years ago #

    Has there been any movement on this? A definate cause / solution been found?

    I've got a friend running WordPress 1.5 that I set up for him and he was just told by one of his site visitors that the error is coming up when this site visitor tried to comment.

    The site is http://www.sticksoffire.com . He's using pop-up comments....

  14. tomhanna
    Member
    Posted 9 years ago #

    I think that particular bit of code is there to prevent spam bots from leaving comments, since they won't show the necessary referrer information. So if the tradeoff is that some nonstandard browser configurations (my Firefox works fine) can't leave comments, I wouldn't mess with it.

  15. shadyq80
    Member
    Posted 9 years ago #

    I found that this error only occurs when I disable referrer logging on Opera 8.01

    I hope this helps.

  16. brazir
    Member
    Posted 8 years ago #

    It's part of Norton's privacy features to disable your browser to send certain information from your machine.

    If the site U leave from or go to rely on this information and has bad coding (to avoid the error if not found) U get the actual error.

    So, the problem lies within the code of the page that faults (partly), Norton default privacy settings or U have manually disabled your browser to send the information needed by the blog to complete its tasks.

  17. scrivener
    Member
    Posted 8 years ago #

    It sounds to me like there are several ways this problem can come about, and that the fixes are just as varied. To clarify for people who might be confused, I'll attempt a quick breakdown. Please correct me if I've got something wrong.

    • If you or someone you know is getting this error, it's probably not a browser problem, but a problem with another program running on the person's computer.
    • Norton programs (antivirus, firewall, and other) seem to especially bring this problem on.
    • Most Norton programs on PCs show up as little icons in the lower-right of your screen (this varies with personal settings). Floating your pointer over the little icons should tell you which ones are Norton programs.
    • One solution is to disable the program while you're at WordPress sites. Right-clicking on the icons will usually produce a menu with "disable" as one of the options.
    • What's going on is a conflict between some programs and WordPress's built-in anti-spam features. Spam-bots are computer programs familiar with the WordPress file structure, so they can quickly generate what is likely a comment page URL and send comment-spam. WordPress is set to disallow these comments, requiring that a user actually click on a WordPress link that leads to the comment entry page. You don't really have to know this, but I think it's good to understand it at least a little.

    I helped a friend who had this problem; it wasn't the antivirus software that was giving the problem, and it wasn't pop-up blockers, though others have said turning off these things has helped. I left those things on and merely disabled the Norton Firewall program, and everything was dandy. I say this because it sounds like there are many ways to run into this error and many ways to fix it; if none of the given suggestions is helping you, play around with those programs your computer is running while you're on the Web.

    Hope this helps someone. The posts above helped me, in that they sent me in the direction toward my fix, despite none of them offering the specific solution that was needed in my case.

  18. areneth
    Member
    Posted 8 years ago #

    hey guys - it just might be something as simple as a firewall on the posting computer -

    as soon as i turned off my kpf i stopped getting the error message

    hope this helps

  19. mybeau
    Member
    Posted 8 years ago #

    Hi there

    It IS a consequence of your firewall parameters.
    And it IS related to your browser (depending on Firewalls capabilities.
    I tried this with Zonealarm Pro and it works:
    OPen ZA control,
    Go to "Program Control" and "Programs" tab
    *For each browser you are using (example below with IExplorer)
    -Search & select Internet Explorer
    -Right click, select "Options"
    -UNcheck (de-select) "Enable privacy for this program" in the "Filter options" of the "Security" tab.
    That's it.

  20. tcpayne
    Member
    Posted 8 years ago #

    The difficulty with the firewall solutions - at least when I tested on my end - is that my Windows XP box has absolutely no software firewall installed, no privacy software, nothing of that sort at all (not even the Windows firewall). The only thing that comes close is NAV Corporate. But the problem occured only in IE, not in FireFox, on the same machine - and I certainly didn't customize non-existent firewall software on the machine to allow one browser but not the other to send referer request headers.

    Also, as usual, my Macs didn't exhibit the problem, unless I turned off the referer request header in Opera. So there's something in IE that's blocking sending that bit o' information, but I'll be damned if I know what it is.

  21. Rebsky
    Member
    Posted 8 years ago #

    Okay. Here's the issue that is causing this:

    1. WordPress has a security feature to make sure that comments are posted from the current site. It does this by checking the HTTP Referer header. Typically, browsers set this header to indicate the page that a user is coming from (i.e. they click a link from www.a.com/foo to www.b.com/bar, so the www.b.com server sees a request for the bar page, and it sees a referer of www.a.com/foo)

    2. Some privacy tools prevent the HTTP referer header from being sent (some firefox extensions, Opera, and some personal firewalls/antivirus products have this option, or leave it enabled all the time).

    Thus there are two solutions.
    1. The blog host can disable the referer check in WordPress by opening up the PHP code and commenting out the if statement that has been mentioned above in this thread.

    2. The person trying to post can disable whatever is stopping the referer header from being sent (whether it is a firewall, antivirus, or a browser feature/extension).

    In reply to tcpayne, perhaps IE is using NAV as an HTTP proxy?

  22. ebaltz
    Member
    Posted 8 years ago #

    I am having the same issue, but with another function. IE is not properly passing or using the $_SERVER['HTTP_REFERER']. FF does it fine, so it is not something related to antivirus or firewall or anything like that, just specific to IE6. Anyone know a different variable that IE will recognise or the specific thing within IE that either enables or disables that?

  23. woolgatherer
    Member
    Posted 7 years ago #

    May I clarify something? This problem arose with my blog today, for the first time after several years of using WordPress.

    My host (Moose Internet Services) went belly up last week and I have had to move hosting to Dreamhost. My newly-installed WordPress is 2.0.4, I was running 2.0.3 previously, with no problems at The Moose.

    Dreamhost say this, in their wiki:

    "Finally, we have put a tiny little hack of our own in the wp-comments-post.php and wp-comments-popup.php files to try and prevent automated comment spam a bit. If you end up never getting any comment spam, it may be that that little hack was enough!"

    Now... I looked at my WP code, and I found the section indicated in this thread. I had a wp-comments-post file with the code at the head (before the requires statement) and a popup file, which had only this piece of code in it.

    Alarm bells rang.

    We looked at the WordPress official download for 2.0.4 and this code does not appear

    What I want to know is - was this code at some time in the official WP release? or was it NEVER there and are all the people who have reported the problem in fact hosted at Dreamhost?

    I've commented the code out for now but I need to work out what to do if this is a Dreamhost hack (the code was uncommented!!) and they are likely to reintroduce it with any automatic upgrade processes.

    I'd appreciate comments on my thoughts

    Thanks you

  24. veryvera
    Member
    Posted 7 years ago #

    I had the same issue and I use Choopa.com so it can't just be dreamhost...

    I am really hoping for a solution that works on this one. I will try to comment out the code above. But the answer just can't stop at - Norton people will have to do A,B and C. WordPress should work around the Norton issue for their next build. At least, that is my hope.

    :)
    v

    On a side note, I don't have that line of code in my comments or comments popup php pages?? How can that be?

  25. woolgatherer
    Member
    Posted 7 years ago #

    Thanks, V - I shan't have a go at my hosts about it then.

  26. imiger
    Member
    Posted 7 years ago #

    Well, I get the same error message at every time, when I try to leave a comment on my own blog: imiger.com/blog.

    It displays an empty page with the text:

    Error: This file cannot be used on its own.

    People at DreamHost suggested to me to come to this forum.

    I have tried it with IE, FireFox and Opera... all the same. However, other people were able to leave comments...

    Any idea?

    Greetings,

    Tamas, Budapest

  27. woolgatherer
    Member
    Posted 7 years ago #

    Hi imiger

    It is pretty clear (to me at least) that this problem affects some users, based on their firewall and security software. It is definitely caused by the Dreamhost hack of the WordPress files. Commenting the hack out cures the problem.

    I think the fact that WordPress installations on other hosts also exhibit the same problem might be down to them deploying a similar tactic. Of course, there can be no level of certainty about this.

    Whatever - if you comment out the code in your comments and comments pop up files, the problem does go away. It comes back when using the Dreamhost 1-click upgrade though ;-)

    To be clear - it is only these lines that need removing or commenting out:

    if (!$_SERVER['HTTP_REFERER'] == dirname(__FILE__) . '/wp-comments.php')
    {
    die ('Error: This file cannot be used on its own.');
    }

    (my comments pop up file consisted of only this code, and nothing else)

    The files in question are in the root of the installation, not in any of the theme directories.

    The usual caveats apply - but it worked for me and for those of my readers who were affected. Hope this helps.

  28. katykat
    Member
    Posted 7 years ago #

    This worked for me, thanks. I just ugraded to the latest wordpress and then this error started happening. Edited out those lines and bingo, problem solved. Even remembered to backup the file I was changing in case I broke it :)

  29. lynx77
    Member
    Posted 7 years ago #

    @woolgatherer

    Thankyou so much - those little devils at Dreamhost were messing around again *trying* to be helpful but causing endless problems for us bloggers!

    Commenting out that piece of code thats in a file named 'wp-comments-popup.php' in the root directory for Dreamhost users worked a treat.

    I don't want to tell everyone to disbable their firewall JUST to leave a comment on my blog - why should they have to?

    Thanks again, you saved me a lot of leg work trying to solve this one.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.