htaccess 和 AddType/Addhandler

发布于 2024-10-20 10:16:14 字数 654 浏览 2 评论 0原文

我的主站点脚本使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

摇划花蜜的午后 2024-10-27 10:16:14

我对你的问题有点困惑,你的意思是你在同一台服务器上运行 php 4 和 5,并希望网站的某些部分运行 php4,某些部分运行 php5?

如果它是新服务器并且您无法使发布的代码工作,您是否尝试过

 AddType application/x-httpd-php .php .php4 .php3 .phtml .tpl .html

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

 AddType application/x-httpd-php .php .php4 .php3 .phtml .tpl .html
淡忘如思 2024-10-27 10:16:14

服务器需要运行最新的 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文