使用的.htaccess启用PHP短标记标记、htaccess、PHP

2023-09-02 00:52:56 作者:Bestial 兽

我的Apache建立自己的Centos的服务器上有多个虚拟Web服务器,我想启用PHP的短标签只有一个是位于 /无功/网络/ ostickets这些Web服务器/ HTML 。我可以成功地使短标记添加 short_open_tag的值为=在为php.ini,但是,我不希望在全球范围内做到这一点,但只有一个网站。我已经试过以下,但不会显示任何内容。我已经看了各种日志,并不能检测到任何错误。难道我无意中禁止这样做的能力,如果是的话我怎么让它(参考的如果您没有访问php.ini文件,你可以试着让他们槽.htaccess文件,但这是可能的托管公司禁用此,如果您使用的是共享主机:的)

  [根@ VPS的html]#PWD
在/ var / WWW / ostickets / HTML
[根@ VPS的html]#LS -la .HTA *
-rw-R  -  R-- 1根60根10月1日07:38的.htaccess
[根@ VPS的html]#猫的.htaccess
#的php_flag short_open_tag的值为上

php_value short_open_tag的值为1



[根@ VPS的html]#猫的test.php
&LT ;?回声(你好世界');?>
[根@ VPS的html]#
 

解决方案

有你的Apache 的AllowOverride全部配置此目录?

I have Apache set up on my own Centos server with several virtual web servers, and I wish to enable PHP short tags for only one of those web servers which is located at /var/www/ostickets/html. I can successfully enable short tags by adding short_open_tag=On to php.ini, however, I don't wish to globally do so, but only the one site. I've tried the following, however, nothing is displayed. I've looked at various logs, and cannot detect any errors. Is it possible that I inadvertently disabled the ability to do so and if so how do I allow it (reference "If you don't have access to the php.ini you can try to enable them trough the .htaccess file but it's possible the hosting company disabled this if you are on shared hosting:").

[root@vps html]# pwd
/var/www/ostickets/html
[root@vps html]# ls -la .hta*
-rw-r--r-- 1 root root 60 Oct  1 07:38 .htaccess
[root@vps html]# cat .htaccess
# php_flag short_open_tag on

php_value short_open_tag 1



[root@vps html]# cat test.php
<? echo('Hello World');?>
[root@vps html]#
如何在windows下Apache环境开启htaccess伪静态功能

解决方案

Have you Apache directive AllowOverride All configured for this directory ?