# Problems with 'require (./xxx)' on IIS7.5

I'm not sure if this is best suited to the Wordpress SE site or if it should be on Server Fault or SO... Either way:

I'm having problems running Wordpress on a brand new 2008R2 server running IIS7.5. I get an error stating that a required file cannot be found:

PHP Fatal error: require(): Failed opening required './wp-blog-header.php' (include_path='.;C:\php\pear') in D:\path\to\my\site\blog\index.php on line 17

Having looked around the web I can see that a lot of people have had this problem and fixed it by removing the './' part of the require statement - however this is not a good solution. The same syntax is used all over Wordpress and needs to be replaced across many files. Additionally if I update the site, the problem will reoccur.

I have this working with no problems on an R1 (IIS7) server and also on my local Win 7 machine - the first I've seen of this issue is here on the R2 server.

Can anyone give me any help to get './' relative paths working for Wordpress?

Thanks

This turned out to be a permissions issue. It seems that in order for './your_filename.php' to work, the user PHP is running as needs to have 'List folder contents' permissions on the folder - even though the file is directly specified.

In the end, the full solution involved turning Fast CGI impersonation off, getting PHP to run as the Application Pool identity and giving that more access to the wordpress folder.

There was some information on this in a question on SO - I can't seem to find it now but will link to it in my answer if I come across it again.

try this web.conf

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule 1" stopProcessing="true">
<match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> </rule> <rule name="WordPress Rule 3" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
</rule>
<rule name="WordPress Rule 4" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
</conditions>
<action type="None" />
</rule>
<rule name="WordPress Rule 5" stopProcessing="true">
<action type="Rewrite" url="{R:2}" />
</rule>
<rule name="WordPress Rule 6" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?(.*\.php)\$" ignoreCase="false" />
<action type="Rewrite" url="{R:2}" />
</rule>
<rule name="WordPress Rule 7" stopProcessing="true">
<match url="." ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>


Above mentioned code will make the rules for ISS for rewriting the URLs, It work as .htaccess works for apache.

• A little explanation of waht your code does and why it solves the problem is always wellcome. – cybmeta Nov 14 '14 at 9:03
• Hi @cybmeta, I have updated the answer and gave a little description on what it does. – Tarun Gupta Nov 15 '14 at 5:36
• Rewrite rules and include paths are not related at all. – fuxia Nov 15 '14 at 6:14