我知道标题可能有点混乱,所以让我解释一下。
我有Apache2与PHP7.0和Mysql,工作完全正常,我重复我的虚拟机,并试图安装一个SSL证书,让我们说,没有顺利,我不得不重新安装apache2和php7.0。
现在,如果我去我的网站是这样的: http://example.com/ : http://example.com/然后,PHP不执行,但是,如果我访问http://example.com/index.php ,那么它工作得很好。 此外,我只是指出,我说PHP不执行,页面本身(index.php的HTML)显示没有问题。
另外,我目前在Ubuntu 16上。
任何人有任何想法? 谢谢!
我似乎已经解决了这个问题:
<FilesMatch "\.php$"> SetHandler application/x-httpd-php </FilesMatch>
“.php $”不在引号内,将它们放在引号内似乎已经修复了。
你需要更新你的域的configuration(可能在httpd.conf中)并添加以下内容:
</Directory> DirectoryIndex index.php index.html </VirtualHost>
例如:
<VirtualHost 127.0.0.1> ServerName mysite DocumentRoot "C:/wamp/www/mysite" <Directory "C:/wamp/www/mysite"> allow from all order allow,deny AllowOverride All </Directory> DirectoryIndex index.php index.html </VirtualHost
这将告诉Apache,index.php是您的首选索引文件。