PHP Error Log Displaying HTML code instead of errors

Home Forums BulletProof Security Pro PHP Error Log Displaying HTML code instead of errors

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #6262
    AITpro Admin
    Keymaster

    BPS Pro Question Copied from WordPress.org:

    http://wordpress.org/support/topic/error-log-file-full-of-timedatestamp-code?replies=1

    Hello, the bps_php_error.log file is simply full of the following:

    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:14]
    [24-May-2013 17:37:16]
    [24-May-2013 17:37:16]
    [24-May-2013 17:37:16]
    [24-May-2013 17:37:16]
    [24-May-2013 17:37:16]
    [24-May-2013 17:37:16]
    [24-May-2013 17:37:16]
    [24-May-2013 17:37:16]
    [24-May-2013 17:37:16]

    The only thing I can think of is that I have password-protected the wp-admin folder via htaccess. I have already whitelisted the ajax handler for another plugin. Is there something else I am missing?

    #6263
    AITpro Admin
    Keymaster

    The most logical cause for something like this might have something to do with this php.ini directive below or your php/php.ini handler is not correct for your particular Server/PHP version or some other php.ini directive could be causing this.  Rename you custom php.ini file to __php.ini to isolate the source of the issue/problem to your custom php.ini file.  If your particular Server allows php_flag and php_value directives in .htaccess files then comment those directives out in your .htaccess file.  If you are using a php/php.ini handler in your .htaccess file then comment out that php/php.ini handler code.

    Source:  http://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors

    html_errors boolean

    Turn off HTML tags in error messages. The new format for HTML errors produces clickable messages that direct the user to a page describing the error or function in causing the error. These references are affected by docref_root and docref_ext.

    #7071
    Bill Justesen
    Participant

    What finally solved it was deleting the plugin, removing all of the backups, and dropping the BPS tables in the SQL database. I then reinstalled BPS Pro and now it is working properly. I’ve used this plugin with five (5) other sites without problem so there was just something funky and unknown going on. Either way, you can mark this thread as resolved.

    #7072
    AITpro Admin
    Keymaster

    I guess the exact cause will remain a mystery.  Thanks for posting the steps that resolved the problem and confirming all is well.

    #14396
    Bill Justesen
    Participant

    I haven’t had this problem in about a year, but it has returned. My PHP error log is getting full of junk again:

    [BPS Pro htaccess Protected Secure PHP Error Log]
    [01-Apr-2014 19:27:06]
    [01-Apr-2014 19:27:06]
    [01-Apr-2014 19:27:06]
    [01-Apr-2014 19:27:06]

    I’ve tried deleting the plugin and all associated files on the server (including the bps-backup folder as that remains after a plugin uninstall) and I had verified that the BPS tables are deleted in the mySQL database. After I’ve reinstalled the latest plugin, I am still getting the errors.

    I know I can turn off error reporting, but it is a useful diagnostic tool for me. Any help you can provide will be awesome. Thanks!

    #14399
    AITpro Admin
    Keymaster

    I merged your Topic into this old duplicate Topic.  Will post some ideas in a second, but logically I don’t think that is being caused by BPS and must be something like it is being caused by a Server configuration setting or maybe a php handler or php.ini file.  And logically BPS is not creating the php error log entries and is only displaying the log entries made by your Server or something else that is similarly odd.

    #14401
    AITpro Admin
    Keymaster

    I was able to recreate / simulate this exact problem/issue by doing this below.  Using the PHP error_log() function incorrectly and doing something dumb/non-standard/not correct/hinky like this below.  So what you need to do is search through any/all plugin code for any plugins that you have installed that might be writing to the php error log for debugging purposes. What you will be searching for is the PHP error_log() function used incorrectly somewhere in that plugin’s code.

    The exact simulation / test that was done was this:

    error_log('<div><h1><ul>Testing logging HTML to the php error log file since I am an idiot who does not know how to write/use code correctly</ul></h1></div>', 0, "blah", "blahn");

    The Result logged in the PHP Error log file:

    [01-Apr-2014 22:09:33 UTC] <div><h1><ul>Testing logging HTML to the php error log file since I am an idiot who does not know how to write/use code correctly</ul></h1></div>

    http://www.php.net/manual/en/function.error-log.php

    #14412
    Bill Justesen
    Participant

    I’m downloading the plugin folder to search all PHP files for the error_log function. Thanks for the heads up…

    #14413
    AITpro Admin
    Keymaster

    You can use the BPS Pro Pro-Tools String Finder tool to search the /plugins/ folder for the “error_log” function.  If you do not find “error_log” in the /plugins/ folder then search the /themes/ folder next.

    #14415
    Bill Justesen
    Participant

    I’ve narrowed it down to three possible files. I’ll disable and I’ll keep you posted.

    \all-in-one-seo-pack\aioseop_class.php
    Line 2502: @error_log( date( 'Y-m-d H:i:s' ) . " " . $message . "\n", 3, $this->log_file );
    
    \graceful-pull-quotes\graceful-pull-quotes.php
    Line 51: error_log($this->style_dir);
    Line 52: error_log($this->style_url);
    
    \InlinePosts\inlineposts.php
    Line 151: error_log($tableOfContents);
    #14418
    Bill Justesen
    Participant

    Well, it turned out to be the InlinePosts plugin and I simply commented out that line. It looks like someone left it in to debug, then forgot to remove it as it will ALWAYS submit to the error log regardless of an actual error. Thanks for helping me out!

    #14421
    Bill Justesen
    Participant

    Thankfully the graceful quotes plugin actually had the lines commented out already. Since it was a multi-line comment, there wasn’t a // beforehand. That brought it down to the two plugins. I should have guessed the third one (inlineposts) as the other would have included a second, and redundant, date in the log.

    Glad to know this in the future, though, so hopefully I can troubleshoot a bit more before asking for help again.

    #14422
    AITpro Admin
    Keymaster

    This was a tricky one.  I originally looked at the problem like it was the result of some good coding doing something wrong instead of bad coding doing what it does best – taking a dump.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.