How To Troubleshoot PHP Errors, php errors in your php error log

Home Forums BulletProof Security Pro How To Troubleshoot PHP Errors, php errors in your php error log

Viewing 15 posts - 1 through 15 (of 259 total)
  • Author
    Posts
  • #528
    AITpro Admin
    Keymaster

    Why am I seeing PHP errors and what do they mean?
    BPS is alerting you that php errors have occurred on your website and logging these errors. BPS is not generating these php errors. In general php errors are a natural thing that will occur on every website intermittently. What is not natural or normal is to see the same php error happening repetitively and continuously. Logged PHP errors should be considered as helpful. PHP errors very accurately display exactly where coding issues or problems are occurring on your website that need to be either looked into or fixed. Fatal php errors need your immediate attention and should be fixed right away.

    PHP Error Types/Levels/Severity
    Strict – PHP will suggest making changes to the code which will ensure the best interoperability and forward compatibility of the code.
    Notice – Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.
    Parse – Compile-time parse errors. Parse errors should only be generated by the parser. Indicates a syntax error in the code.
    Warning – Run-time warnings (non-fatal errors). Execution of the script is not halted.
    Fatal – Fatal run-time errors. These indicate errors that cannot be recovered from, such as a memory allocation problem. Execution of the script is halted.

    Repetitive or continuous php errors usually means that there is a problem with some coding in a plugin or theme (common issue/problem). If you see that a php error is happening over and over again repeatedly you can usually see what the problem is from the error that is logged. If the php error is not obvious you can Google the php error message to find out what it could mean. Copy the portions of the php error that contain the error level, the error description and file name and code line into the Google search window and search for what the error means and the solution. Example: PHP Fatal error: Call to undefined function w3_url_format() in PgCacheAdmin.php on line 213. Do not include your website path in your Google search because the search will probably not return any search results since your website path is unique to only your website.

    php.ini settings in your custom php.ini file can sometimes cause issues/problems with some plugins or themes that may need to use one of the risky or dangerous php functions in a way that appears to BPS as attack against your website. In general BPS starts from the maximum security settings and then allows you to decrease that security on an as needed basis. Example: If a plugin or theme needs to use one of these php functions – allow_url_fopen or register_argc_argv, which are set to Off by default in your custom php.ini file, then you would simply need to set them to On. BPS has several layers of overlapping security protection and fallbacks so if you need to allow a php function that is disabled in the disable_functions directive or set to Off in your custom php.ini file this can be done safely without any significant security risk.

    Another thing that can generate repetitive php errors in your php error log is that a hacker is repetitively trying to exploit some code that may have a known vulnerability in that coding.

    The important thing to note with php errors is that intermittent php errors are considered normal and repetitive or continuous php errors are not normal. So when BPS alerts you that a php error has been logged in your php error log, you want to take a look at the php error in your php error log and if it does not appear to be a serious problem or is just an intermittent php error you can then just click the Reset Last Modified Time in DB button to make the BPS php error notification go away. Php errors are logged by date in descending order. Your php error log is a static log file and php errors will remain in your php error log file until you manually delete them. It is completely up to you to decide whether or not you want to keep these php errors in your log file or delete them.

    #529
    AITpro Admin
    Keymaster

    Email Question:

    A PHP Error has been logged in your PHP Error Log I see this one problem in one of the two sites I am using the plug in on….

    [25-Nov-2012 06:00:05 UTC] PHP Notice: Undefined index: SCRIPT_NAME in /home/xxxxx/public_html/wp-includes/load.php on line 86
    [24-Nov-2012 17:02:12 UTC] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4194304 bytes) in /home/xxxxx/public_html/wp-includes/cache.php on line 506

    Answer:

    These particular php errors are very generalized and are more difficult to troubleshoot since the logged php errors are not telling you where the exact problem is occurring – ie the actual path and name of the plugin or other code where the actual problem is.  What is happening is that a plugin or some other code on your website is calling these WordPress Core files to perform some action or function and instead of that plugin’s page or code being displayed in the logged php error you are seeing php errors logged in an “after the fact” way.

    NOTE:  When you see php errors that indicate an out of memory problem “Allowed memory size of xxxxxx bytes exhausted” this does not necessarily mean that you need to increase your maximum memory limit for your website.  I see this bad information all over the Internet – “You just need to increase your maximum memory limit for your website”.  The php error is indicating that you do have a coding problem somewhere (or of course it could have just been a random Server hiccup – ie a Database connection randomly failed) and the “symptom” of that coding problem is that you have run out of memory or your memory was exhausted trying to process the actual code that has a problem or error in that coding.  

    Increasing your memory limit may make the php error message go away, but this is obviously a band-aid solution.  You need to track down/isolate the plugin or other coding that is causing the excessive amount of memory usage.  Server Logs are a good place to look for more clues and will usually log the source/origin/plugin/code that is the cause of the excessive memory usage.  Another troubleshooting approach for WordPress websites is to deactivate your plugins one by one until you find the plugin that is causing the problem.  When you find that plugin then you would notify the plugin author about the problem so that he/she can fix the coding problem.  Another approach would be to install the P3 (Plugin Performance Profiler) plugin and run some scans to find out which one of your plugins is using excessive memory and resources on your website.

    How to Search for and Google PHP Errors

    The best way to search for and Google PHP Errors to find out what might be causing them is to take the portions of the php error that DO NOT contain any specific information about your particular website – ie remove your website paths or other specific information that is specific to your website and then ONLY search for Google search terms such as these below:

    PHP Notice: Undefined index: SCRIPT_NAME wp-includes/load.php on line 86

    PHP Fatal error: Allowed memory size exhausted wp-includes/cache.php on line 506

    Since these particular php errors are very generalized then this is going to be a much more difficult thing to figure out, but with that said there are a couple clues as to where the problem is occurring.  It appears that the problem has to do with a caching plugin since the cache.php WordPress Core file is in the php error.  If this php error is occurring repetively then this needs to be fixed immediately.  If the php error message is occurring randomly or intermittently then it is less serious, but should still be tracked down and fixed. 

    This php error “PHP Notice: Undefined index: SCRIPT_NAME” basically means that the /wp-includes/load.php file failed to load properly on 25-Nov-2012 06:00:05 UTC and if this was a one time thing then you can consider the php error a Server hiccup and disregard the php error.  If the php error is occurring repetitively then the load.php file or a file that is calling this file is damaged/missing or has code that needs to be fixed and would indicate that an “include” is not calling the file correctly.

    The Most Important Factor To Consider

    If the php errors are a one time event then there is nothing to worry about since intermittent or random php errors do occur from time to time – this is completely normal.  If php errors are occurring repetitively and continuously then they need to be taken care of immediately.

    #736
    apparence
    Member

    can you give me some lights about these errors ??  i’m just a little french designer… it’s so hard for me !
    What does it mean ?

    [17-Dec-2012 16:06:10] PHP Warning:  Missing argument 2 for wpdb::prepare(), called in /homepages/35/xxxxxxx/htdocs/cartes-de-voeux/wp-content/themes/sofa_downloadshop/author.php on line 168 and defined in /homepages/35/xxxxxxx/htdocs/cartes-de-voeux/wp-includes/wp-db.php on line 990
    [17-Dec-2012 16:06:34] PHP Warning:  Missing argument 2 for wpdb::prepare(), called in /homepages/35/xxxxxxx/htdocs/cartes-de-voeux/wp-content/themes/sofa_downloadshop/sofa_R2D2.php on line 19 and defined in /homepages/35/xxxxxxx/htdocs/cartes-de-voeux/wp-includes/wp-db.php on line 990
    [17-Dec-2012 16:08:05] PHP Warning:  Missing argument 2 for wpdb::prepare(), called in /homepages/35/xxxxxxx/htdocs/cartes-de-voeux/wp-content/themes/sofa_downloadshop/sofa_R2D2.php on line 19 and defined in /homepages/35/xxxxxxx/htdocs/cartes-de-voeux/wp-includes/wp-db.php on line 990
    [17-Dec-2012 16:24:51] PHP Warning:  Missing argument 2 for wpdb::prepare(), called in /homepages/35/xxxxxxx/htdocs/cartes-de-voeux/wp-content/themes/sofa_downloadshop/functions.php on line 1308 and defined in /homepages/35/xxxxxxx/htdocs/cartes-de-voeux/wp-includes/wp-db.php on line 990
    #742
    AITpro Admin
    Keymaster

    WordPress 3.5 made changes to how they check the wpdb prepare query statement to make sure it is being used correctly.  You will need to contact the Theme Author for your Theme to have him/her correct their coding for WP 3.5.

    #926
    Jan
    Participant

    Hi,
    I got similar php errors which are related to the plugin:

    [08-Jan-2013 17:50:26 UTC] PHP Warning: Missing argument 2 for wpdb::prepare(), called in /home/.../domains/.../public_html/wp-content/plugins/bulletproof-security/admin/includes/admin.php on line 47 and defined in /home/.../domains/.../public_html/wp-includes/wp-db.php on line 990
    [08-Jan-2013 17:50:26 UTC] PHP Warning: Missing argument 2 for wpdb::prepare(), called in /home/.../domains/.../public_html/wp-content/plugins/bulletproof-security/admin/includes/admin.php on line 110 and defined in /home/.../domains/.../public_html/wp-includes/wp-db.php on line 990
    #927
    AITpro Admin
    Keymaster

    These issues have already been corrected.  Please install the latest version of BPS Pro.  To force an upgrade check >>> http://forum.ait-pro.com/forums/topic/bulletproof-security-pro-wp-dashboard-upgrade-update-notification/

    Or to manually install the zip file.

    Go to the AITPro secure download login page, download the zip file, install the zip file using the BPS Pro built-in Upload zip installer – NOT the WordPress Upload zip installer.  Please ensure that you turn off AutoRestore when installing BPS Pro, then click the AutoRestore Backup Files buttons and then turn AutoRestore back on.

     

    #929
    Jan
    Participant

    Hi,
    Thanks for the info, I managed to update the plugin and the error is gone now! 

    #2127
    vidhu
    Member

    dear sir/madam,
    how can i rectify this error  “Fatal run-time errors. These indicate errors that can not be recovered from, such as a memory allocation problem. Execution of the script is halted.”

    #2132
    AITpro Admin
    Keymaster

    Copy the portions of the php error that contain the error level, the error description and file name and code line into the Google search window and search for what the error means and the solution. Example: PHP Fatal error: Call to undefined function w3_url_format() in PgCacheAdmin.php on line 213. Do not include your website path in your Google search because the search will probably not return any search results since your website path is unique to only your website.

    Also with most php errors the error will contain the file name and code line where the error is occurring.  If you understand coding then you can look at that specific code line where the problem is occurring then based on what the error message says you can create a solution by adding additional code or modifying the existing code to fix the problem.  If this is a coding problem in a WordPress plugin then you should notify the plugin author so that they can fix this issue/problem.

    #4461
    outlook
    Participant

    getting the traditional (from what it seems on google)

    WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKEwp_***********' at line 1

    in tandem with:

    WordPress database error Table 'wp_**********' already exists for query CREATE TABLE wp_************

    i’ve been to phpadmin.  there’s 2 databases, with one i did NOT create (plugin created?).  not only that, but the database “in error” is NEITHER one of the 2 databases!

    ok…so i now know there is an error in my SQL syntax AND one of my tables already exists.  WHAT THE HELL DO I DO ABOUT THAT!!!!??????

    if anyone knows a “security” resource–aside from GOOGLE–can someone let me know??
    meanwhile, i know there’s a simple way to handle this and prevent my php error log going off twelve million times a day…..
    HELLLLLLPPPPPPP…..PLEASE!  PLEASE!

    thanks.

    #4463
    AITpro Admin
    Keymaster

    You need to take the parts of the php error message that can be used in a Google search.  There is no other way to troubleshoot WordPress database errors because they are ALWAYS very general and do not tell you exactly where the problem is like standard php code errors.  Example:  error happened in this file X at code line X.  Since the WP Database error is telling you which table to look at then that tells you which plugin is having the problem if the DB error is related to a plugin.

    #4465
    outlook
    Participant

    the problem is that i don’t know what to do with that information.   every listing in google goes over the problem in gory detail EXCEPT for the explicit step-by-step repair.

    i guess my next question is, how do you find someone who knows something about security plugins that can tell you WHAT TO DO once you get into phpadmin? (i’m supposing that’s the garage where all the repairs take place).

    my database table needs to be replaced, repaired, or something….who knows how to do this?

    and btw, from the looks of google, there must be a top 10 of php errors.  table creation errors has to be up there.  no one has a step by step explanation??  of even WHERE TO START?

    once again, i am obviously not a security plugin expert.  can someone point me in a direction?

    #4466
    AITpro Admin
    Keymaster

    This would not have to do anything with security or a security plugin.  php errors happen whenever there is a php code error on your website somewhere or some problem where that php code does not run correctly.  Send the php error in an email to info at ait-pro dot com if you do not want to post it in the Forum and I will do some Googling and find the correct links to send you.  If you are looking for someone to fix this then if this is a problem with a particular plugin or theme then you would contact that plugin author or theme author.  If this is a general database problem and you cannot fix it then you just need to find any coder who also knows how to fix database issues/problems.

    #4467
    AITpro Admin
    Keymaster

    Also are you aware that there has been a worldwide attack on WordPress and Joomla websites going on?  This is causing massive amounts of WordPress database errors.  This has been going on for over a week now so if these database errors have only been happening in the last week or so then that is why they are happening.  The same this is happening on the AITpro websites intermittently for the last week or so.

    http://forum.ait-pro.com/forums/topic/global-brute-force-attack-on-wordpress-sites/

    #7948
    Lys
    Participant

    Hi & thx ahead for your ideas/help –

    Currently showing these errors (see BPS Pro PHP Error Log below). Are they anything to worry over? Our server recently had some maintenance so not sure if this is contributing to these php errors. Latest WP version 3.5.2 recently installed / latest BPS Pro version 6.0 recently installed:

    [BPS Pro htaccess Protected Secure PHP Error Log]

    [24-Jul-2013 13:09:07 UTC] WordPress database error MySQL server has gone away for query SELECT option_value FROM wpnew_options WHERE option_name = '_transient_doing_cron' LIMIT 1 made by _get_cron_lock
    [25-Jul-2013 13:43:47 UTC] WordPress database error MySQL server has gone away for query SELECT option_value FROM wpnew_options WHERE option_name = '_transient_doing_cron' LIMIT 1 made by _get_cron_lock
Viewing 15 posts - 1 through 15 (of 259 total)
  • You must be logged in to reply to this topic.