htaccess 和 AddType/Addhandler
我的主站点脚本使用 php4,并且它与 AddHandler 配合得很好。由于服务器默认配置为 php5.3,我假设将另一个脚本添加到子目录时,我所要做的就是使用下面的 Addhandler/AddType 之一,但是它不起作用。当我在页面作为下载发送到浏览器之前添加 3 行中的任何一行时,它根本不会处理要显示的文件。除了 Addhandler 之外,我的 htaccess 完全是空白的。这也是在专用服务器上。
AddType application/php5-script php html tpl
AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml .tpl .html
AddHandler application/x-httpd-php53 .php .php4 .php3 .phtml .tpl .html
to explain better..
1. www.site.com is run php4 (script req. it)
2. www.site.com/newscript/ needs php5
3. i put a .htaccess in the www.site.com/newscript/ folder with
Addhandler for php5 but it doesn't work
My main site script uses php4, and it works fine with the AddHandler. Since the server is configured or php5.3 by default I assume when adding another script to a subdirectory all i would have to do is use one of the following Addhandler/AddType below but, it does not work. When I added anyone of the 3 lines before the pages are sent to the browser as a download so it doesn't process the file for display at all. my htaccess is completely blank expect for the Addhandler. Also this is on a dedicated server.
AddType application/php5-script php html tpl
AddHandler application/x-httpd-php5 .php .php4 .php3 .phtml .tpl .html
AddHandler application/x-httpd-php53 .php .php4 .php3 .phtml .tpl .html
to explain better..
1. www.site.com is run php4 (script req. it)
2. www.site.com/newscript/ needs php5
3. i put a .htaccess in the www.site.com/newscript/ folder with
Addhandler for php5 but it doesn't work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对你的问题有点困惑,你的意思是你在同一台服务器上运行 php 4 和 5,并希望网站的某些部分运行 php4,某些部分运行 php5?
如果它是新服务器并且您无法使发布的代码工作,您是否尝试过
Am a bit confused by your question, do you mean you are running php 4 and 5 on the same server and want some parts of the site to run php4, some php5?
If it's a new server and you can't get the posted code to work have you tried
服务器需要运行最新的 PHP 5.3,您可以使用
.htaccess
降级到 PHP 4,但如果服务器未运行至少 PHP 5.3,则无法使用.htaccess
降级到 PHP 4代码>.知道了?Server needs to be running latest PHP 5.3, you can downgrade with
.htaccess
to PHP 4 but if server is not running at least PHP 5.3 you can not make it do so with.htaccess
. Got it?