IIS üzerinde barındırılan zaman html gömülü php kod yürütme değil

2 Cevap
<HTML>
<HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <TITLE></TITLE>
</HEAD>
<BODY>
    <?php echo '<p>Hello World</p>'; ?>   
</BODY>
</HTML>

Ben bir tarayıcıda Yukarıdaki kodu çalıştırdığınızda, firefox bu gibi işler:

Hello World

'; ?> 

I am doing my coding in Windows XP/IIS 5.1. I have PHP set up correctly because I have no problem running .php files. The problem, it seems to me, is that IIS can't render php code embedded inside html. Does anyone know how to fix this problem or should i switch to Apache?

edit:. dosya uzantısı html

2 Cevap

Sen PHP yorumlayıcı aracılığıyla .html dosyalarını çalıştırmak yerine doğrudan onlara hizmet için IIS söylemek gerekir.

Biraz googling bu kadar açık ki ... kimse yok nasıl emin değilim:

N.B. / Caveat emptor Ne şu Microsoft Support site alınan ve cevap Perl ile IIS kurmak için - Ben de PHP için çalışması gerektiğine inanıyoruz, ya da en azından sağda sizi başlayacaktır izlemek, ama ben IIS yok gibi ben henüz denemedim.

Click Start, click Programs, click Administrative Tools, and then click Internet Information Services. Right-click a Web site that you want to enable PHP for, and then click Properties. Click the Home Directory tab. Click Configuration. Click Add. Type the following for Executable: full path to php.exe\php.exe %s %s Note The "%s %s" is case sensitive (for example, "%S %S" does not work). For Extension, type .html.

Note Make sure that the All Verbs option is selected for full functionality. Also, make sure that the Script Engine check box is selected. Click OK to return to the ISM. With the default scripts directory with IIS, the URL is the following: http:// Server Name/scripts/helloworld.html

The same problem using windows 7 IIS and php can be solved by going to Start->Control_panel->Administrative_Tools->Internet_Information_Services_(IIS)_Manager. Then you have to select the connection, which has a problem, then double click "Handler mappings",

on the right side of the table you can see "Actions" panel, click on the "Add module mapping", in the "Request path" field you have to write "*.html" (without quotes), in the "Module" section choose "FastCgiModule", in the "Executable" section locate the path of php-cgi.exe file, in the "Name" section write let's say "html" (wihtout quotes),

then push the "Request Restrictions button", mark the "Invoke handler only if request is mapped to" and choose "File or folder" hit ok, hit ok one more time, click "Yes"

Şimdi IIS sunucu *. html belgelerinde php script anlamak gerekir.