DACworx - David Austin Crowell

PHP IIS: Fix require_once Path To File Is Not Found

I always wanted to work with Drupal and I decided that today's the day. I found that many users were using IIS for their Drupal sites, so I was encouraged. Made sure that my server's PHP and MySQL installs were compatible and then I downloaded the Drupal files. I followed the instructions in the text files and installed the files on my web server's test site. 

Then the next step is to point my Firefox browser to the test site. But a whole lot of nothing happened. I got the dreaded "White Screen of Death" blank page. No HTML, nothing. 

An empty white screen is not very useful. So I went into the php.ini file on my server and turned error display on:
display_errors = On

Then restarted IIS. My test site is now displaying a PHP error:
Warning "require_once(./includes/bootstrap.inc)" failed to open stream No such file or directory...

Right away I saw that the error was with the "./" in the path. In the past I read on multiple help sites that IIS and PHP together do not work with / absolute paths or ./ root paths You may use relative paths ../ or call to the C:/ server drive path. So I was wondering how the Drupal on IIS users were getting things done without writing every root path in every Drupal file.

Found after this issue was not addressed very well anywhere, but as I googled for answers I was finding references about web permissions. So I did some poking at the permissions to the site. I found that if the IUSR_"YourServerName"  user is granted read access to the parent folder of the site folder, that require_once or include_path file is miraculously found by PHP.

So if the home directory local path is:
C:\Inetpub\domain.com\wwwroot

Grant read permissions to IIS anonymous user on:
C:\Inetpub\domain.com\

I was then able to configure the test site's Drupal settings and go live. 

Finally I went back to php.ini and turned display errors back to off:
display_errors = Off

...and restarted IIS.


PHP IIS: Fix require_once Path To File Is Not Found
I always wanted to work with Drupal and I decided that today's the day. I found th ... More

Contact: David Austin Crowell