• Resolved VesperaWebDesigns

    (@vesperawebdesigns)


    I upgraded to BP Security 51.3 today at a client’s website, and after getting the .htaccess files set up properly, I am seeing the following PHP error message when accessing the admin portion of the website:

    Warning: file_put_contents([pathname].htaccess) [function.file-put-contents]: failed to open stream: Permission denied in [pathname]wp-content/plugins/bulletproof-security/includes/functions.php on line 1933.

    Line 1933 is in the function bpsPro_htaccess_manual_update_notice()

    .htaccess has permissions of 404, as recommended.

    I am not detecting any other errors in the operation of the website on either the user or administrative portions.

    https://ww.wp.xz.cn/plugins/bulletproof-security/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author AITpro

    (@aitpro)

    if ( preg_match( $pattern, $check_string, $flush_matches ) ) {
    	$stringReplace = preg_replace('/\n#\sBEGIN\sWordPress\s*<IfModule\smod_rewrite\.c>\s*RewriteEngine\sOn\s*RewriteBase(.*)\s*RewriteRule(.*)\s*RewriteCond((.*)\s*){2}RewriteRule(.*)\s*<\/IfModule>\s*#\sEND\sWordPress\n/s', "", $check_string);
    	file_put_contents($filename, $stringReplace);
    }

    What this means is the default WordPress Rewrite code exists in the root htaccess file, but since the file is locked it cannot be automatically removed. Check if this code below has been saved to any Custom Code text boxes and delete it, click the Save Root Custom Code button, go to the BPS Security Modes page, click the Create secure.htaccess File AutoMagic button and activate root folder BulletProof Mode.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    Thread Starter VesperaWebDesigns

    (@vesperawebdesigns)

    Problem solved. Thank you very much!

    Plugin Author AITpro

    (@aitpro)

    Very welcome. I am pretty sure we are going to do this in a future version of BPS: automatically unlock the root htaccess file, remove that code if it exists, lock the root htaccess file again. Then do an additional separate inpage Custom Code check and display a message for that – “X exists in Y do Z”.

    Dominic Heselmans

    (@better-world-webdevelopment)

    Hi,

    I got the same problem but the code snippet that VesperaWebDesigns deleted is needed in my case by W3 total cache or else it starts to complain it doesnt know what fancy links I’m using.
    How do i solve this?
    Thank you for your help.

    Plugin Author AITpro

    (@aitpro)

    BPS already has/uses the standard WordPress htaccess code (the same code that W3TC is complaining is not there). It is incorporated into the standard BPS root htaccess file code, but is in a different format so W3TC does not see it. You can just remove/delete the default WordPress Rewrite htaccess code and dismiss/hide the W3TC displayed message.

    https://ww.wp.xz.cn/support/topic/new-update-and-w3tc-permalinks-issue?replies=8

    The standard WordPress Rewrite code

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    BPS root htaccess file incorporates the standard WordPress Rewrite code

    # WP REWRITE LOOP START
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    ...
    ...
    BPS security code between the START and END code
    ...
    ...
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # WP REWRITE LOOP END
    Dominic Heselmans

    (@better-world-webdevelopment)

    Ok, I’ve deleted the standard WordPress Rewrite code and hidden the eror message in W3TC.

    Thank you for the feedback and help.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘PHP error message when viewing admin portion of site’ is closed to new replies.