Jump to content

ProcessWire on Windows7/2008 Server with IIS WebServer


nikola
 Share

Recommended Posts

Hi to all,

As I've mentioned earlier to Ryan, ProcessWire runs fine on Windows 7/2008 Server setup with IIS 7.5 WebServer with IIS Mod-Rewrite from Micronovae that can read .htaccess file. The problem is that this IIS filter is free for development use on localhost without limitations but it's not free for production use on live server (it costs $150 per server license).

I've found another solution that works flawlessly and it's absolutely free.

  • Download URL Rewrite Module 2.0 for IIS from http://www.iis.net/download/urlrewrite and install it
  • Define new web site under "sites" in IIS Manager and point it to directory where you've unzipped ProcessWire files
  • Download web.config (translated from original .htaccess) file from this post, unzip it and put it in ProcessWire root directory
  • Delete .htaccess file (because you don't need it any more).

I hope that this will help someone if the need arises for ProcessWire use on this kind of install.

web.config.zip

  • Like 8
Link to comment
Share on other sites

  • 10 months later...
  • 6 months later...
  • 3 months later...

Thanks this was helpful. Only change I had to make was for this section:

                <denyUrlSequences>
                    <add sequence="inc" />
                    <add sequence="info" />
                    <add sequence="module" />
                    <add sequence="sh" />
                    <add sequence="sql" />
                    <add sequence="\..*" />
                </denyUrlSequences>
 
I had to remove the  <add sequence="module" /> line. It gave me a 404 for the module section in the admin until I removed that.
  • Like 3
Link to comment
Share on other sites

  • 2 months later...

Thanks this was helpful. Only change I had to make was for this section:

                <denyUrlSequences>
                    <add sequence="inc" />
                    <add sequence="info" />
                    <add sequence="module" />
                    <add sequence="sh" />
                    <add sequence="sql" />
                    <add sequence="\..*" />
                </denyUrlSequences>
 
I had to remove the  <add sequence="module" /> line. It gave me a 404 for the module section in the admin until I removed that.

After adding this piece of code I had a problem with the URLs (/information/, /show-all/ etc. ). This manifested itself even in the names of pictures.(trash.png, showreel.png) The problem is that you forgot to put the points. Right?

                <denyUrlSequences>
                    <add sequence=".inc" />
                    <add sequence=".info" />
                    <add sequence=".sh" />
                    <add sequence=".sql" />
                    <add sequence="\..*" />
                </denyUrlSequences>
  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Excellent information.  I too have just successfully installed Processwire on Windows Server 2008 running IIS 7.  Thanks to everybody posting on this page.

Extra information from my situation in case somebody else is running into similar issues.  I had never even heard of this CMS until I was told I needed to install it to host a web site for a subsidiary.  I had previously installed PHP and MySQL on the system and really didn't feel like installing Apache if I didn't need to do so.  I took a leap of faith after reading on the Requirements page that "A user has reported that that were able to install ProcessWire on IIS 7 in Windows 7."

Issues and Resolutions

Rename /site-default to /site

The files you download for Processwire include the folder "site-default", just rename the folder as requested.  I was looking to see how IIS interpreted the default web site and was confused immediately.  It's a real simple request when you know what it means.

Error 500 reported within the browser

Immediately I got the 500 error in the browser.  That didn't mean much to me so I executed the PHP script from command line.

Open a command prompt and navigate to the directory in which you are installing Processwire

type full path to php.exe or php-cgi.exe and then install.php e.g. C:\myphpfolder\php.exe install.php

This will report the error generated in the script and not just the generic 500 error.  In my case PW could not find MySQL on the host.

 

Error 2002 No such host is known (Database connection error)

I did a bunch of searching for this.  The error actually occurred in the /wire/core/ProcessWire.php file.  In review of the code I realized it was parsing the page location to find the "localhost" name.  In my case I was not using the default website and I had another name not recognized by (I assume) the hosts file (C:\Windows\System32\drivers\etc).  After thinking about it now, I could have probably added the name I had in the hosts file.

My resolution was to "Add Application" within the Default Website in IIS pointing to the install location.  Now localhost is a valid host name and MySQL could be located.

 

Error 404 file or folder

The Processwire home page was fine, but no sub-directory calls worked.  That's when I found this post. 

I took nikola's suggestion: "Download URL Rewrite Module 2.0 for IIS from http://www.iis.net/download/urlrewrite and install it"

I downloaded the web.config file he provided and placed it in the Processwire root

I removed the <add sequence="module" /> entry as stated by jamestflynn

Then finally incorporated the suggestions by zlojkashtan as I understood why that would be important

 

The default site is running.  The URL rewrites are working.  You guys are awesome.

  • Like 5
Link to comment
Share on other sites

  • 4 weeks later...

I'm a .NET web application developer so I naturally like to host my sites with IIS. I also do some Wordpress on the side and host those sites on IIS as well.

I was excited about trying out processwire because I'm attracted to the content-type-first approach. I tried a few Themeforest Wordpress templates and I felt like they didn't use Custom Types where I thought they should and if they did there were extraneous meta-boxes that confused me and my clients.

It took me a while to find this post and the sample web.config. I searched the forums for web.config and came up with over 100 results. Then I tried to search for IIS but it's only 3 letters so it didn't work. Finally I tried "web.config" and found this post. 

I recommend putting instructions on the Download page (maybe just a short blurb and the web.config file) or on the Requirements page or FAQ or somewhere where new IIS users like myself can easily find it. I created my database, downloaded the zip, loaded the folder in WebMatrix, ran the site, ran through the installer, and everything worked like a charm until I clicked on "About" and got a 404 error. 

I purchased a HTML template from Themeforest and can't wait to cut it up for Processwire. I plan on creating types for FAQs, Testimonials, and gallery posts. I also purchased the Wordpress template of the same theme so this will provide me a great comparison.

TL DR: It would be good if a sample up-to-date web.config file was on the Download or Requirements page.

Thanks!

Philip

  • Like 2
Link to comment
Share on other sites

  • 6 months later...

Sorry to resurrect, but after following all the steps here I now have PW working fine in its own IIS site. However i actually need PW working as a subdirectory of a root site. Currently the homepage is fine, but anything else is getting handled like a 404 of the root site. Cant get to the admin or anything. Any ideas?

Main Site - example.com 

Desired PW Site - example.com/pw

Thanks!

Link to comment
Share on other sites

Have you read and followed the instructions in post #8 above? Particularly the bit about "Error 404 file or folder". It sounds like you need to download and install a separate url rewrite module.

Hope that helps?

Link to comment
Share on other sites

Thanks for the quick reply!

URL Rewrite 2.0 is actually installed and working quite well. As a matter of fact the root directory that the ProcessWire install is to be a subdirectory in is also a PHP Application using URL Rewrite 2. Also confirming that ProcessWire works fine when it's in a standalone IIS site. However it has issues once placed in a subdirectory in another IIS Site.

Come to think of it, im beginning to suspect it may be the root Application's rewrite rules in it's web.config file.

I'll investigate and advise.

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

I am trying to install ProcessWire 2.5 on IIS using the instructions above, but the installer won't progress if it can't find a .htaccess file with mod_rewrite.

  •  Unable to determine if Apache mod_rewrite (required by ProcessWire) is installed. On some servers, we may not be able to detect it until your .htaccess file is place. Please click the 'check again' button at the bottom of this screen, if you haven't already.
  •  /.htaccess doesn't exist. Before continuing, you should rename the included htaccess.txt file to be .htaccess (with the period in front of it, and no '.txt' at the end).

This kind of makes sense, as the instructions in this thread say to remove the .htaccess file so of course it can't be found. Has something changed in the installer that means it now can't be installed on IIS? Is there some way to disable this check so I can progress with the installation, or just download a blank installation from somewhere?

I really hope I can get this working because ProcessWire looks like exactly what I want from a php CMS

Link to comment
Share on other sites

To answer my own question above...

Just edit the install.php script and comment out lines 315-327

		if(function_exists('apache_get_modules')) {
			if(in_array('mod_rewrite', apache_get_modules())) $this->ok("Found Apache module: mod_rewrite"); 
				else $this->err("Apache mod_rewrite does not appear to be installed and is required by ProcessWire."); 
		} else {
			// apache_get_modules doesn't work on a cgi installation.
			// check for environment var set in htaccess file, as submitted by jmarjie. 
			$mod_rewrite = getenv('HTTP_MOD_REWRITE') == 'On' || getenv('REDIRECT_HTTP_MOD_REWRITE') == 'On' ? true : false;
			if($mod_rewrite) {
				$this->ok("Found Apache module (cgi): mod_rewrite");
			} else {
				$this->err("Unable to determine if Apache mod_rewrite (required by ProcessWire) is installed. On some servers, we may not be able to detect it until your .htaccess file is place. Please click the 'check again' button at the bottom of this screen, if you haven't already."); 
			}
		}

and lines 356-365

		if(!is_file("./.htaccess") || !is_readable("./.htaccess")) {
			if(@rename("./htaccess.txt", "./.htaccess")) $this->ok("Installed .htaccess"); 
				else $this->err("/.htaccess doesn't exist. Before continuing, you should rename the included htaccess.txt file to be .htaccess (with the period in front of it, and no '.txt' at the end)."); 

		} else if(!strpos(file_get_contents("./.htaccess"), "PROCESSWIRE")) {
			$this->err("/.htaccess file exists, but is not for ProcessWire. Please overwrite or combine it with the provided /htaccess.txt file (i.e. rename /htaccess.txt to /.htaccess, with the period in front)."); 

		} else {
			$this->ok(".htaccess looks good"); 
		}

Link to comment
Share on other sites

  • 4 months later...
  • 5 months later...
I have been the webmaster for my company's websites for over seven years using the eZ Publish (www.ez.no) CMS but now my Marketing Department wants a responsive site, which eZ Publish v4 does not do. v5 is supposed to be responsive but they want an arm and a leg for it so I am now looking for a different, more modern solution. I like the looks of Processwire and am trying it out using a Windows IIS 7 web server (a requirement by the IT department where I work. )

 

Thanks to everyone who has posted here, especially nikola and jamestflynn.

 

Here's an update for those using later software versions:

 

To successfully install Processwire v2.6.1-Master on a Windows IIS 7 Web Server with:

PHP v5.6.9

MySql v5.7

 

Copy the following XML into a file called web.config at the ProcessWire root directory

(Most of this file is from user nikola's post from June 19, 2011 with a couple of sections deleted):

 

-------- begin snip ----------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<configuration>

<system.webServer>

<directoryBrowse enabled="false" />

<rewrite>

            <rules>

                <rule name="Handle request for missing favicon.ico" stopProcessing="true">

                    <match url="favicon\.ico" />

                    <action type="CustomResponse" statusCode="404" subStatusCode="1"

                        statusReason="The requested file favicon.ico was not found"

                        statusDescription="The requested file favicon.ico was not found" />

                </rule>

<rule name="Handle request for missing robots.txt" stopProcessing="true">

                    <match url="robots\.txt" />

                    <action type="CustomResponse" statusCode="404" subStatusCode="1"

                        statusReason="The requested file robots.txt was not found"

                        statusDescription="The requested file robots.txt was not found" />

                </rule>

<rule name="Access Restrictions: Keep web users out of directories">

                    <match url="(^|/)\." ignoreCase="false" />

                    <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />

                </rule>

                <rule name="Access Restrictions: Protect ProcessWire system files" stopProcessing="true">

                  <match url="^.*$" ignoreCase="false" />

                  <conditions logicalGrouping="MatchAny">

                        <add input="{URL}" pattern="(^|/)site/assets/(cache|logs|backups|sessions|config|install)($|/.*$)" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)site/install($|/.*$)" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)site/config\.php$" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)(wire|site)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)site/templates($|/|/.*\.(php|html?|tpl|inc))$" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)site/assets($|/|/.*\.php)$" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)wire/(core|modules)/.*\.(php|inc|tpl|module)$" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)site/modules/.*\.(php|inc|tpl|module)$" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)(COPYRIGHT|INSTALL|README|htaccess)\.txt$" ignoreCase="false" />

                        <add input="{URL}" pattern="(^|/)site-default/" ignoreCase="false" />

                  </conditions>

                  <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />

                </rule>

<rule name="ProcessWire Rewrite" stopProcessing="true">

                    <match url="^(.*)$" ignoreCase="false" />

                    <conditions logicalGrouping="MatchAll">

                        <add input="{URL}" pattern="^/~?[-_.a-zA-Z0-9/]*$" ignoreCase="false" />

                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />

                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />

<add input="{REQUEST_FILENAME}" pattern="(favicon\.ico|robots\.txt)" ignoreCase="false" negate="true" />

<add input="{URL}" pattern="\.(gif|jpg|png|ico)$" negate="true" />

                    </conditions>

                    <action type="Rewrite" url="index.php?it={R:1}" appendQueryString="true" />

                </rule>

            </rules>

        </rewrite>

        <defaultDocument>

            <files>

                <add value="index.php" />

            </files>

        </defaultDocument>

    </system.webServer>

</configuration>

 

-------- end snip ----------------------------------------------------------------

 

As mentioned in several of the posts above, be sure to have the IIS URL Rewrite Module 2.0 installed.

 

Also, before starting the installation you will need to replace some values in the .sql database installation commands located in the various site-*/install/install.sql files. In the definition of the "modules" and "pages" tables and in the insertions for the "modules" table replace the default and inserted values for the "created" field, which is a timestamp data type field. The values supplied are all '0000-00-00 00:00:00' which is outside the allowed range for a timestamp type field in this version of MySQL (see https://dev.mysql.com/doc/refman/5.0/en/datetime.html). Replace these zero values with a value within the Unix Epoch, like '1970-01-01 00:00:01'.

 

Begin the installation and ignore the warning about "Unable to determine if Apache mod_rewrite (required by ProcessWire) is installed." Of course it can't be found because we aren't running Apache.

 

Have fun!
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...