How to support “AddType x-mapp-php5 .php” on my development machine

和自甴很熟 提交于 2019-12-01 05:29:22

问题


My ISP requires me to put the following in my .htaccess files:

AddType x-mapp-php5 .php

But that breaks my development machine.

I don't really understand what that directive is for, but I'm sick of commenting it out for dev, and uncommenting it whenever I need to upload a new version.

Is there some way of supporting it in dev?


回答1:


You could try the <IfModule> Apache directive to distinguish your development machine from the production machine.

E.g. the following would work if you're running PHP as an Apache module, and your ISP runs it as CGI:

<IfModule !mod_php5.c>
AddType x-mapp-php5 .php
</IfModule>

You could also check for the existence of a PHP4 module.

Or you could pass a startup parameter to Apache on your development machine and check for that using <IfDefine>.




回答2:


This merely tells the web server that files with the extension .php are to be handled by the PHP module.

But I would recommend asking web-server related questions on serverfault.com, where your question won't get closed (with the reason belongs on serverfault.com) and where you will receive much better answers than here.



来源:https://stackoverflow.com/questions/1094310/how-to-support-addtype-x-mapp-php5-php-on-my-development-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!