PHP Fatal error: Cannot redeclare bpspro_ap_check

Home Forums BulletProof Security Pro PHP Fatal error: Cannot redeclare bpspro_ap_check

Viewing 15 posts - 31 through 45 (of 69 total)
  • Author
    Posts
  • #23006
    AITpro Admin
    Keymaster

    The cause and solution for this problem is here: https://forum.ait-pro.com/forums/topic/php-fatal-error-cannot-redeclare-bpspro_ap_check/page/4/#post-25456

    So logically then something outside of your website has changed.  Ie something on the host server or an external service that you are using like cloudlare or a CDN.  Or something like a configuration file is not correct for your new server.  Ie php.ini files are not interchangeable between web host servers, whether you are moving to a new host or even just switching servers on the same host.  Do this below.

    1.  Completely delete the /wp-content/plugins/bulletproof-security/ plugin folder and any other renamed /bulletproof-security/ plugin folders (ie /_bulletproof-security/ etc) that you see in your /plugins/ folder and reinstall BPS Pro using the WordPress Upload Zip Installer.

    2.  If you have created a custom php.ini file then rename it to php.ini.BAK

    If the php error is still occurring at this point then either something that you have installed on your website (ie another plugin, etc) is reloading pages in your WP backend twice or doing something with object buffering that is loading things twice or caching your backend and loading things twice or something on your server is malfunctioning.  ie a Proxy misconfiguration, etc.  If you would like for me to login to the site to find what is causing the problem then create a temporary WordPress Administrator user account and send the login information to:  info at ait-pro dot com.

    #23010
    Glasairmell
    Participant

    Looking for a common thread across the sites on some plugin that could have gone bad.

    #23056
    jenni101
    Participant

    Hi,

    For the last 2 days I’ve been getting the same php errors as reported here:

     PHP Fatal error:  Cannot redeclare bpsPro_AP_Check() (previously declared in /home/xxx/public_html/wp-content/plugins/bulletproof-security/includes/functions.php:54) in /home/xxx/public_html/wp-content/plugins/bulletproof-security/includes/functions.php on line 67

    I’ve read all through this thread and reloaded a clean install of BPR Pro via the BPS zip install page, then run the setup wizards again. All seemed OK, but I’ve just rechecked and they’re back again, about once every 30 – 50 mins. I’ve also had a few other php errors with out of memory messages – all for different files, not one in particular, so not sure what’s happened. (Everything is totally up to date.)

    The one main thing I have done recently is I removed the code to disable wp-cron in my wp-config.php and removed the cron job in my cPanel (wget -O /dev/null http://mysite.com/wp-cron.php?doing_wp_cron). This is related to another thread here: http://forum.ait-pro.com/forums/topic/disable-wp-cron/

    Not sure what I should do now, as nothing else on my server has changed. Also I don’t have a CND and am not using CloudFlare. But I do have a seperate php.ini that my server added – could that be the problem, maybe when I reinstalled BPS? or could it be related to other recent plugin updates??

    Any insight would be great! Many thanks.

    #23058
    AITpro Admin
    Keymaster

    The cause and solution for this problem is here: https://forum.ait-pro.com/forums/topic/php-fatal-error-cannot-redeclare-bpspro_ap_check/page/4/#post-25456

    “If you have created a custom php.ini file then rename it to php.ini.BAK” to test if that is what is causing the problem.  I think this forum topic already covers any possibilities that I can think of so I cannot think of any other possibilities. 😉

    #23060
    jenni101
    Participant

    OK. I thought I’d check it first in the BPS php info area and when I ran the Diagnostice check it said “PHP|php.ini Handler: A PHP|php.ini Handler was Not found in your Root .htaccess file.” But when I look in my root it is there! And when I use the PHP File Finder it’s there – and I’ve added it to the file manger for good measure. Then when I click the ‘View PHP Info’ button it shows this: PHPINFO File viewing is enabled for your IP address only === xxx.yyy.aaa.bbb Your PHPINFO file is htaccess protected.” So a bit confused now, as I don’t actually need to create a php.ini file, just for BPS to recognise it. What about if I turn off ARQ, resave my root folder and then turn back on ARQ? Would that do the trick? Just thought I should make sure BPS recognises it before I start to rename it… Thanks.

    …just reread your post of 24th May…

    If the php error is still occurring at this point then either something that you have installed on your website (ie another plugin, etc) is reloading pages in your WP backend twice or doing something with object buffering that is loading things twice or caching your backend and loading things twice…

    I did install Zen Cache, but it was about 4 days ago, so this problem didn’t start immediately – hence I thought it was unrelated – maybe not? I’ll look into that, but would still apreciate your advice re the php.ini as above 🙂

    #23063
    AITpro Admin
    Keymaster

    The cause and solution for this problem is here: https://forum.ait-pro.com/forums/topic/php-fatal-error-cannot-redeclare-bpspro_ap_check/page/4/#post-25456

    A PHP|php.ini Handler was Not found in your Root .htaccess file – should probably be changed to:  A PHP|php.ini Handler .htacess code was Not found in your Root .htaccess file.  That check is looking in your root .htaccess file for that code. The PHP File Finder looks for php.ini files.

    I have seen around 5 individual cases total in 14 months of this particular php error.  The general theme for the cause/source of the the error is something outside of BPS is causing a problem for BPS, which then generates that php error.  There seems to be a range of things that can break this BPS function so what I will be looking at is changing the BPS Pro function itself – ie be resistant/resilient against whatever is breaking this particular function.

    #23064
    AITpro Admin
    Keymaster

    That gave me an idea which I just tested and I have finally been able to reproduce this php error.  I will change that particular function in BPS Pro 10.4 so that it can no longer generate a php error at all.

    #23082
    jenni101
    Participant

    So shall i just ignore all these php errors until then? or is there something that I should do to resolve it before your next release?

    If you think it’s related to a particular plugin i could see if I can do without it until then, too. But as well as this fatal error I’m still getting intermittent ‘out of memory’ errors for a seemingly random selection of files, plus now getting another one:

    PHP Fatal error:  Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0

    I’ll try deactivating the Zen Cache and will report back too.
    Cheers.

    PS. Not sure if this is relevant, but when I installed Zen Cache, it suggests an optional GZIP code in the .htaccess file of this:Perhaps this could be part of the problem??
    [ZenCache caching code deleted – it is not related to the issue]
    Many thanks.

    #23085
    AITpro Admin
    Keymaster

    The cause and solution for this problem is here: https://forum.ait-pro.com/forums/topic/php-fatal-error-cannot-redeclare-bpspro_ap_check/page/4/#post-25456

    Nope the php error is not related to another plugin.  Nope nothing you can do as a workaround since that particular function handles Anti-Piracy checking.  😉  It is a server issue with processing that particular function.  It has been fixed and tested working in BPS Pro 10.4.  No ETA for 10.4 at this time. Just ignore this php error for now.

    I do not see any clues in the php error you posted.  I have no idea what would cause that php error.  You can do the standard WordPress troubleshooting steps.  ie deactivate plugins one by one to find out if the php error is coming from a particular plugin, but it sounds more like a server issue.  Probably best to check with your host on that first before digging around on your site.

    #23089
    jenni101
    Participant

    OK, thanks again.

    #23569
    Glasairmell
    Participant

    Hi,

    Still getting this error in 10.5

    Cannot redeclare bpsPro_AP_Check() (previously declared in
    #23571
    AITpro Admin
    Keymaster

    The cause and solution for this problem is here: https://forum.ait-pro.com/forums/topic/php-fatal-error-cannot-redeclare-bpspro_ap_check/page/4/#post-25456

    Ok that confirms 100% that the problem is on your end and not in the BPS code.  So you want to eliminate the possibility that that particular function does actually really exist twice (the declared function and not the executed function).  A cannot redeclare php error usually means that a function name has been duplicated or used twice/declared twice.  ie if 2 different plugins happen to be using the same exact function name then this php error will occur.  If there are 2 files loading that have this same exact function name declared in them then this php error will occur.  These are the actual real cases for that particular php error.  But I do not think either of these things are actually happening and what is most likely occurring is a problem on your end.  Something like the server is loading things twice due to some configuration problem.  Some type of object buffering problem where things are being loaded twice.  A proxy misconfiguration problem where things are being loaded twice.  The general idea is that your server or something else that you have installed or configured is loading things twice, which then triggers that php error because PHP thinks that function has been declared twice.

    So to eliminate that the php errors are actually really occurring because the function is duplicated somewhere use the BPS Pro String|Function Finder (not DB String Finder) Pro-Tool and do a search using these search parameters. below

    Search String:  bpsPro_AP_Check
    Search Path: /copy-the-path-you-see-displayed-to-you-on-the-page-and-then-add/wp-content/plugins/

    You should end up with these search results:
    Search string found 24 times.

    The portion of the path in the search results for that function name should be:  /wp-content/plugins/bulletproof-security/  if you see a different path in any of the search results then post that search result.
    ___________________
    Actually this is a better search to do.  You should end up with only 1 search result:  Search string found 1 times.  Also copy your entire php error log contents and paste it in an email and send it to info at ait-pro dot com. There may be other clues in your php error log that indicate what the root cause of problem is. ie other buffering errors occurring, intermittent DB connectivity problem, etc.

    Search String:  function bpsPro_AP_Check
    Search Path: /copy-the-path-you-see-displayed-to-you-on-the-page-and-then-add/wp-content/plugins/

    • C:/xampp/htdocs2/aitpro-blog/wp-content/plugins/bulletproof-security/includes/functions.php, line 54
      function bpsPro_AP_Check($D8) {
    #23586
    Glasairmell
    Participant

    Ok will get on this Monday. Thank you sir.

    #23905
    jenni101
    Participant

    Hi again,

    I’ve been ignoring this error quite happily on my 3 sites as recommended above (May 31st) as they’ve only been happening occasionally. But in the last few days I’ve been absolutely inundated (19 zipped log files in 2 days!) with php error logs emailed to me from one site only, with the only error being the one I originally posted on May 28th:

    Cannot redeclare bpsPro_AP_Check() (previously declared in /home/xxx/public_html/wp-content/plugins/bulletproof-security/includes/functions.php:54) in /home/xxx/public_html/wp-content/plugins/bulletproof-security/includes/functions.php on line 67

    So I ran the check you suggested above for the Search String “function bpsPro_AP_Check” and it did only return one resulkt exactly as you said. The only other thing that happened was that I got notified about a change to the database which occurred one day before this all kicked off – the change was made by the WP Google Maps plugin, which seems to do these things without my input off and on anyway. Coincidence or cause?? Not sure if this helps or not? I’ll try the standard WP troubleshooting steps later today and will let you know the outcome. Many thanks.

    #23907
    AITpro Admin
    Keymaster

    The cause and solution for this problem is here: https://forum.ait-pro.com/forums/topic/php-fatal-error-cannot-redeclare-bpspro_ap_check/page/4/#post-25456

    “19 zipped log files in 2 days” are they Security Log zip files?  If so, your site is probably being Brute Force attacked.  We usually get 48 zip files in 2 days – 1 per hour due to 1,000’s of attacks per second being blocked/stopped when this forum site is being attacked, which is a pretty regular thing these days.  Big yawn and smile because these attacks do not negatively impact anything – business as usual, but with some emails telling us BPS Pro has everything under control as usual.

    That php error you are seeing is being caused by something on your end.  We have 100% eliminated that the problem is with the BPS function itself.  So one of the things listed in this forum topic is causing the problem.  We can login and take a look at your website, environment, server or the any other possible causes of the error.  If you would like that then send an Administrator login to this site to:  info at ait-pro dot com.

Viewing 15 posts - 31 through 45 (of 69 total)
  • You must be logged in to reply to this topic.