0

I need to host a php based website on IIS and I have come across some strange behaviour of .php files.

When I try to open index.php, I get the white screen of death. There are no error logs (I turned them On). I thought, that there is maybe an error in my code, althought it worked on Xampp, but neverthless I tried some simple code:

<html> <body> <?php echo "Hello World!"; ?> </body> </html> 

I opened x.x.x.x/hello.php and got a white screen.

This could be caused by many problems, so I started testing them and this is where it got strange, so:

To the same directory I placed hello.html with the same content, but instead of the php part there is <p>Hello world</p>. When I try to open x.x.x.x/hello.html it works and there is Hello world text displayed.

So I thought that there is problem with the .php part. I placed phpinfo.php with <?php phpinfo(); ?> to inetpub/wwwroot. I opened localhost/phpinfo.php and it loaded all php info content.

Then I copied the hello.php to inetpub/wwwroot and opened localhost/hello.php and it worked, the browser displayed Hello world!

In short. In inetpub/wwwroot .php files work correctly and I am able to run them in browser. In any other directory of my Sites I get a white screen. But only with .php files. Html files runs normally.

So, I am really confused with this strange behaviour. I am new to the IIS, so I may have overlooked something, but right now I am stuck and I don't know what to do. Although I am able to run the website on inetpub/wwwroot, this is not the solution I am looking for.

Thank You for all the help.

1
  • You should review your php.ini to see if settings like doc_root are set. Commented Sep 27, 2019 at 4:49

1 Answer 1

0

Well, I gave up. Uninstalled and then reinstalled everything from the beginning including .Net frameworks, IIS, php extension, etc. ... and it is working now. It might been caused by that I haven't had .NET framework 3.5 installed. I had installed versions 2xx and 4xx, but it seems, that I missed to install 3.5

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.