Apache AddHandler:将 ASP 代码作为 PHP 运行
我正在运行 XAMPP。
我可以在 .htaccess 或 http.conf 中添加一行以使 ASP 被解析并作为 PHP 页面处理吗?
我之前设置过,但不记得怎么做了。到目前为止我所尝试的方法还没有奏效。
编辑:这些解决方案都不起作用,我已经尝试了所有方法。
I'm running XAMPP.
Is there a line I can add to .htaccess or http.conf to make ASP be parsed and handled as PHP pages?
I had it setup before but can't remember how to do it. What I've tried so far hasn't worked.
Edit: None of these solutions are working, I've tried everything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果以上解决方案都不适合您,请使用 phpinfo() 检查您的服务器 API;方法。
如果服务器 API 是 CGI 或 FAST CGI,请将其更改为 Apache 2.0 Handler。您可以使用 Plesk Panel 或 CPanel 来完成此操作。
另一个选择是不更改服务器 API,而是更改 .htaccess 或 httpd.conf : http://avinashsing.sunkur.com/2012/04/19/how-to-map-another-file-extension-to-the- php-parser-through-htaccess/。
但我已经解决了第一个问题。
If none of the solution above is ok with you, check your Server API with phpinfo(); method.
If Server API is CGI or FAST CGI change it to Apache 2.0 Handler.You can do it using Plesk Panel or CPanel.
Another option is not to change Server API but .htaccess or httpd.conf : http://avinashsing.sunkur.com/2012/04/19/how-to-map-another-file-extension-to-the-php-parser-through-htaccess/.
But I have solved my problem with the first one.
也许试试这个:
Maybe try this:
将其添加到您的 httpd.conf
Add this to your httpd.conf
尝试将此行添加到 .htaccess;
显然,它不如添加与 http.conf 等效的内容那么有效,但即使您无权访问 http.conf,它也能工作。
Try adding this line to .htaccess;
Apparently it is not as efficient as adding the equivalent to http.conf but it works even when you don't have access to http.conf.
在
.htaccess
中添加这一行使我能够执行在 .asp 页面中编写的 PHP 代码:Adding this line in
.htaccess
enabled me to execute PHP code written in .asp pages:Apache 没有用于 ASP 处理的模块。为此,您必须使用 IIS。现代 IIS 可以运行 PHP,因此您可以反其道而行之,使用 IIS 并将 PHP 插入其中。
Apache does not have a module for ASP processing. You have to use IIS for that. Modern IIS can run PHP so you may do it the other way around, use IIS and plug PHP into it.