IIS7 PHP fopen / fwrite sorun

1 Cevap php

Windows Server 2008 R2 üzerinde IIS7 PHP5 çalıştırıyorum. Bir XML dosyasına bir POST isteği parametre üzerinden alınan bir dize yazar aşağıdaki kodu göz atın.

<?php
$temp = "";
if($_SERVER['REQUEST_METHOD']=="POST"){
    if($_POST["operation"]=="saveLevels"){
    	$fileHandle = fopen("c:\\inetpub\\wwwroot\\test\\xml\\levels.xml", 'w');
    	fwrite($fileHandle, stripslashes($_POST["xmlString"]));
    	fclose($fileHandle);
    	$temp = "success";
    }elseif($_POST["operation"]=="saveRules"){
    	$fileHandle = fopen("c:\\inetpub\\wwwroot\\test\\xml\\rules.xml", 'w');
    	fwrite($fileHandle, stripslashes($_POST["xmlString"]));
    	fclose($fileHandle);
    	$temp = "success";
    }
}

When I make a POST request to invoke this code, the application pool owning/hosting the site containing php files, stops (due to some fatal errors, as it writes in event viewer) and then IIS keeps responding with HTTP503 after that. Now, I have given proper permissions to IUSR and IISUSRS on that (test/xml) directory. Those two XML files are not already existing, I have also tried the code when an XML file is already present but; it behaved the same way. What's wrong with that php code? I have tried it on a linux-box and it behaved as expected.

edit: ben bu kodu çeşitli farklı versiyonlarını denedim ve bu sonuç ile geldi: fopen çağrısı bir POST isteği uyandırmak zaman, daima YANLIŞ veya bazen NULL döndürür ve durdurmak için kendisi Uygulama Havuzu neden olur. Aynı kod, aynı parametrelerle, bir GET isteği ile Tamam çalışır. Yani; Ben sorunun ne olduğunu bilmiyorum ama; zaman için ben sadece bu işlem için GET isteklerini kullanmak için gidiyorum.

1 Cevap

Bunu ne bize göstermek için, her iki seçenek için ($ FILEHANDLE) var_dump olabilir. Ben sadece (YANLIŞ ise fwrite başarısız olur) dosya açıldığında varsayarak ziyade değerini kontrol ediyoruz fark