Roots Discourse

Warning about wordfence plugin on deployment

Hi, this isn’t terribly urgent, everything still works, but one of our sites has been outputting a long string of angry PHP warnings every time we deploy. It seems that during task “Get WP theme template root” ansible tries to look for a file in the vendor directory that doesn’t exist. This warning is related to the Wordfence plugin, which is installed via composer.

Here’s the error (the company name has been replaced with ‘XXXX’ for privacy)

PHP Warning:  fopen(/srv/www/XXXX.com/releases/20210113153757/web/app/
wflogs/rules.php): failed to open stream: No such file or directory in /srv/w
ww/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/w
ordfence/wf-waf/src/lib/waf.php on line 325
Warning: fopen(/srv/www/XXXX.com/releases/20210113153757/web/app/wflog
s/rules.php): failed to open stream: No such file or directory in /srv/www/qu
orumhubnu.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfe
nce/wf-waf/src/lib/waf.php on line 325
PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /s
rv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vend
or/wordfence/wf-waf/src/lib/waf.php on line 326
Warning: flock() expects parameter 1 to be resource, boolean given in /srv/ww
w/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wo
rdfence/wf-waf/src/lib/waf.php on line 326
PHP Warning:  include(/srv/www/XXXX.com/releases/20210113153757/web/ap
p/wflogs/rules.php): failed to open stream: No such file or directory in /srv
/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor
/wordfence/wf-waf/src/lib/waf.php on line 328
Warning: include(/srv/www/XXXX.com/releases/20210113153757/web/app/wfl
ogs/rules.php): failed to open stream: No such file or directory in /srv/www/
XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/word
fence/wf-waf/src/lib/waf.php on line 328
PHP Warning:  include(): Failed opening
'/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php'
for inclusion (include_path='phar:///usr/bin/wp/vendor/phpunit/php-token-
stream:phar:///usr/bin/wp/vendor/phpunit/phpunit-mock-
objects:phar:///usr/bin/wp/vendor/phpunit/php-code-coverage:phar:///usr/bin/w
p/vendor/phpunit/phpunit:phar:///usr/bin/wp/vendor/symfony/yaml:.:/usr/share/
php') in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wor
dfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328
Warning: include(): Failed opening
'/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php'
for inclusion (include_path='phar:///usr/bin/wp/vendor/phpunit/php-token-
stream:phar:///usr/bin/wp/vendor/phpunit/phpunit-mock-
objects:phar:///usr/bin/wp/vendor/phpunit/php-code-coverage:phar:///usr/bin/w
p/vendor/phpunit/phpunit:phar:///usr/bin/wp/vendor/symfony/yaml:.:/usr/share/
php') in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wor
dfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328
PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /s
rv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vend
or/wordfence/wf-waf/src/lib/waf.php on line 329
Warning: flock() expects parameter 1 to be resource, boolean given in /srv/ww
w/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wo
rdfence/wf-waf/src/lib/waf.php on line 329
PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /
srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/ven
dor/wordfence/wf-waf/src/lib/waf.php on line 330
Warning: fclose() expects parameter 1 to be resource, boolean given in /srv/w
ww/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/w
ordfence/wf-waf/src/lib/waf.php on line 330
fatal: [104.131.59.83]: FAILED! => {"changed": false, "cmd": ["wp", "option", "get", "template_root"], "delta": "0:00:01.883002", "end": "2021-01-13 15:38:38.749107", "failed": true, "failed_when_result": true, "rc": 0, "start": "2021-01-13 15:38:36.866105", "stderr": "PHP Warning:  fopen(/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php): failed to open stream: No such file or directory in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 325\nWarning: fopen(/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php): failed to open stream: No such file or directory in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 325\nPHP Warning:  flock() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 326\nWarning: flock() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 326\nPHP Warning:  include(/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php): failed to open stream: No such file or directory in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328\nWarning: include(/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php): failed to open stream: No such file or directory in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328\nPHP Warning:  include(): Failed opening '/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php' for inclusion (include_path='phar:///usr/bin/wp/vendor/phpunit/php-token-stream:phar:///usr/bin/wp/vendor/phpunit/phpunit-mock-objects:phar:///usr/bin/wp/vendor/phpunit/php-code-coverage:phar:///usr/bin/wp/vendor/phpunit/phpunit:phar:///usr/bin/wp/vendor/symfony/yaml:.:/usr/share/php') in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328\nWarning: include(): Failed opening '/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php' for inclusion (include_path='phar:///usr/bin/wp/vendor/phpunit/php-token-stream:phar:///usr/bin/wp/vendor/phpunit/phpunit-mock-objects:phar:///usr/bin/wp/vendor/phpunit/php-code-coverage:phar:///usr/bin/wp/vendor/phpunit/phpunit:phar:///usr/bin/wp/vendor/symfony/yaml:.:/usr/share/php') in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328\nPHP Warning:  flock() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 329\nWarning: flock() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 329\nPHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 330\nWarning: fclose() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 330", "stderr_lines": ["PHP Warning:  fopen(/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php): failed to open stream: No such file or directory in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 325", "Warning: fopen(/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php): failed to open stream: No such file or directory in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 325", "PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 326", "Warning: flock() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 326", "PHP Warning:  include(/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php): failed to open stream: No such file or directory in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328", "Warning: include(/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php): failed to open stream: No such file or directory in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328", "PHP Warning:  include(): Failed opening '/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php' for inclusion (include_path='phar:///usr/bin/wp/vendor/phpunit/php-token-stream:phar:///usr/bin/wp/vendor/phpunit/phpunit-mock-objects:phar:///usr/bin/wp/vendor/phpunit/php-code-coverage:phar:///usr/bin/wp/vendor/phpunit/phpunit:phar:///usr/bin/wp/vendor/symfony/yaml:.:/usr/share/php') in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328", "Warning: include(): Failed opening '/srv/www/XXXX.com/releases/20210113153757/web/app/wflogs/rules.php' for inclusion (include_path='phar:///usr/bin/wp/vendor/phpunit/php-token-stream:phar:///usr/bin/wp/vendor/phpunit/phpunit-mock-objects:phar:///usr/bin/wp/vendor/phpunit/php-code-coverage:phar:///usr/bin/wp/vendor/phpunit/phpunit:phar:///usr/bin/wp/vendor/symfony/yaml:.:/usr/share/php') in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 328", "PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 329", "Warning: flock() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 329", "PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 330", "Warning: fclose() expects parameter 1 to be resource, boolean given in /srv/www/XXXX.com/releases/20210113153757/web/app/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/waf.php on line 330"], "stdout": "/themes", "stdout_lines": ["/themes"]}

If anyone knows why ansible is stuck on this issue, or how to get it to stop looking for that file that just isn’t there, let me know!

There is a Trellis plugin for WordFence: