I have two sites on a LAMP stack. One (Site1) uses WordPress with Wordfence, and it works perfectly fine. The second website (Site2) only runs a simple index.php file on it:
<?php
echo "Testing";
?>
However, it shows HTTP ERROR 500 with the error log as below.
[Thu Dec 22 16:23:44.774993 2016] [:error] [pid 56607] [client xxx:27253] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Thu Dec 22 16:23:44.775042 2016] [:error] [pid 56607] [client xxx:27253] PHP Fatal error: Unknown: Failed opening required '/var/www/site1/public_html/public/wordfence-waf.php' (include_path='.:/usr/share/php') in Unknown on line 0
Site1 and Site2 have nothing to do with each other, and they are located in separate folders. I am not sure what's happening. Please advise.
.htaccess file on Site1
# 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
# Wordfence WAF
<IfModule mod_php7.c>
php_value auto_prepend_file '/var/www/site1/public_html/public/wordfence-waf.php'
</IfModule>
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
# END Wordfence WAF
Thanks for @EdCottrell. I finally found an answer for that.
First, I debug to find where the php.ini locates by create a info.php on the working site.
Then, I find if there is any value on auto_prepend_file =. If yes, delete it.
Then I open the site1.conf file and add the auto_prepend_file line instead of the one from .htaccess
After restarting the Apache server, everything works again!