• Hi,

    Getting these errors when installing Wordfence using wp CLI.
    Wordpress was a clean install.

    Are these normal for Wordfence and plugin still works 100%?
    What can be done to get a clean install without errors?

    vhost:localhost:~/domains/mysite.com/htdocs> wp plugin install wordfence --activate
    Installing Wordfence Security – Firewall & Malware Scan (7.4.7)
    Laadin paigalduspaketti aadressilt https://downloads.wordpress.org/plugin/wordfence.7.4.7.zip...
    Pakin lahti...
    Paigaldan pluginat...
    Plugin edukalt paigaldatud.
    Activating 'wordfence'...
    Warning: fopen(/data01/vhost/domains/mysite.com/htdocs/wp-content/wflogs/rules.php): failed to open stream: No such file or directory in /data01/vhost/domains/mysite.com/htdocs/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 325
    Warning: flock() expects parameter 1 to be resource, bool given in /data01/vhost/domains/mysite.com/htdocs/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 326
    Warning: include(/data01/vhost/domains/mysite.com/htdocs/wp-content/wflogs/rules.php): failed to open stream: No such file or directory in /data01/vhost/domains/mysite.com/htdocs/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 32                             8
    Warning: include(/data01/vhost/domains/mysite.com/htdocs/wp-content/wflogs/rules.php): failed to open stream: No such file or directory in /data01/vhost/domains/mysite.com/htdocs/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 32                             8
    Warning: include(): Failed opening '/data01/vhost/domains/mysite.com/htdocs/wp-content/wflogs/rules.php' for inclusion (include_path='.:') in /data01/vhost/domains/mysite.com/htdocs/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line                              328
    Warning: flock() expects parameter 1 to be resource, bool given in /data01/vhost/domains/mysite.com/htdocs/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 329
    Warning: fclose() expects parameter 1 to be resource, bool given in /data01/vhost/domains/mysite.com/htdocs/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 330
    Plugin 'wordfence' activated.
    Success: Installed 1 of 1 plugins.
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @d1g1tal,

    It looks like Wordfence can’t write to wp-content/wflogs/*.

    There’s a few things you can try:

    1. Manually create the wp-content/wflogs/* folder, and make sure Wordfence can read/write inside that folder

    2. Tell Wordfence to store the contents of wflogs/* in the database instead

    You can do this by editing wordfence-waf.php and adding define('WFWAF_STORAGE_ENGINE', 'mysqli'); right after <?php on a new line.

    https://www.wordfence.com/help/firewall/mysqli-storage-engine/

    The above link describes in more detail on how to do this.

    What this means is that upon installation you will always receive these errors if your host is preventing read/write to wp-content/wflogs/*, but after the changes in 2), your Wordfence installation should function normally.

    Dave

    Thread Starter d1g1tal

    (@d1g1tal)

    Hi,

    I even tried that I manually create wp-content/wflogs/ folder (chmod 777) before installing wordfence, but still getting same errors.
    Running wp plugin install “wordfence” is always without errors, but when I activate it:
    wp plugin activate “wordfence”
    It gives the same errors not matter what I do.

    But after activation, wp-content/wflogs/ folder is there, it was created and filled with files.

    After installing Wordfence, it’s giving the following errors on EVERY command from the WordPress CLI, but the WAF isn’t even enabled.

    
    Warning: fopen(/home/user/public_html/test/wp-content/wflogs/rules.php): failed to open stream: No such file or directory in /home/user/public_html/test/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 325
    Warning: flock() expects parameter 1 to be resource, bool given in /home/user/public_html/test/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 326
    Warning: include(/home/user/public_html/test/wp-content/wflogs/rules.php): failed to open stream: No such file or directory in /home/user/public_html/test/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328
    Warning: include(): Failed opening '/home/user/public_html/test/wp-content/wflogs/rules.php' for inclusion (include_path='.:/opt/alt/php73/usr/share/pear')in /home/user/public_html/test/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328
    Warning: flock() expects parameter 1 to be resource, bool given in /home/user/public_html/test/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 329
    Warning: fclose() expects parameter 1 to be resource, bool given in /home/user/public_html/test/wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 330
    
    • This reply was modified 5 years, 3 months ago by Jason Allen.
    • This reply was modified 5 years, 3 months ago by Jason Allen.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Errors when installing using WP-CLI’ is closed to new replies.