Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache htaccess文件已忽略addhandler,未执行directoryindex sttings_Apache_.htaccess - Fatal编程技术网

Apache htaccess文件已忽略addhandler,未执行directoryindex sttings

Apache htaccess文件已忽略addhandler,未执行directoryindex sttings,apache,.htaccess,Apache,.htaccess,我刚刚用php和mysql服务器设置了Apache服务器。 我的问题是,我的html文件中有php块,但它们根本没有执行。 如果html文件包含在php文件中,则执行块。因此,php模块似乎不提供html文件 我试图在htaccess文件中更改此选项: # Do not remove this line, otherwise mod_rewrite rules will stop working RewriteBase / #AddHandler application/x-httpd-php

我刚刚用php和mysql服务器设置了Apache服务器。 我的问题是,我的html文件中有php块,但它们根本没有执行。 如果html文件包含在php文件中,则执行块。因此,php模块似乎不提供html文件

我试图在htaccess文件中更改此选项:

# Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /

#AddHandler application/x-httpd-php .html .php 
#AddHandler php5-script  .php
#AddHandler php5-script  .html

#AddType text/html .php
#AddType text/html .html
#AddType application/x-httpd-php .html

RemoveHandler .html .htm AddType application/x-httpd-php5 .html .htm

DirectoryIndex home.html index.php
我可以看出htaccess文件被忽略,因为它没有执行directoryIndex命令。 我已经尝试了上面所有的AddType和AddHandler,它们现在都被注释掉了

我已将以下内容添加到httpd.conf文件中:

AllowOverride All
但当我保存它时,会出现一个警报,说明文件已成功上载,但在设置权限或时间戳时出错

在Apache文档中,它建议我在某个对话框中打开“忽略权限错误”,但我在任何地方都看不到这些对话框。 我在哪里可以找到这些。它在WinSCP中吗?如果是,在哪里

我的html和php块问题的方向是否正确, 或者addingHandler和addType不能解决问题。
放置这些更改的最佳位置是什么?

很抱歉给您添麻烦。事实证明,只需将文件扩展名从html更改为php就足够了。 我一直认为必须在php页面上回显任何HTML内容,但事实并非如此。 所以现在它只是运行。
谢谢

您是否将
AllowOverride All
添加到conf的Directory指令中?我真的不明白您为什么希望由php解释器处理html模板。为什么不把html代码放到php文件中,而不把vica代码放到php文件中呢?(例如将html文件重命名为php)我将AllowOverride放在httpd.conf文件中。事实上,我认为服务器忽略了这个文件,同时我也把DirectoryIndex home.html命令放在了那里(我把它放在那里作为一个检查,看看这些更改是否有任何影响,它们没有影响)。应该有一个VHOST文件优先于所有文件吗?(我在Amazon上)以及在哪里或如何找到它。我可以使用Putty命令找到它吗?我使用html文件中的php块来包含导航栏、标题以及自定义对象等内容,这些内容在每个页面上看起来相同,但在包含到页面上之前从文件中读取不同的内容。如果我把它做成一个php文件,我需要回显所有html部分,然后你会遇到双引号和单引号交替出现的问题。而且我已经用这种方式建立了我的整个网站。改变它将是一项艰巨的任务。我的网站是第一个在另一台主机上的,在那里根本没有问题。所以我只需要得到这些.html文件