[en] Installing SilverStripe on IIS server

UPDATE 2009-02-17: As Sigurd from SilverStripe team states in a comment, You shouldn’t need to follow my „howto” – at least if You’re using IIS 7. Since I wrote this „howto”, SilverStripe website has been improved to include installation instructions on IIS so please give it a try before proceeding with my old instructions.

1. Install ISAPI/Rewrite. I have no idea how to do it since it was already installed at my provider’s server, but there probably is a limited free version that is enough.
2. Download SilverStripe archive and extract it to Your server.
3. Go to Your server’s URL and fill in installer details as usual.
4. After rewritetest fails, create httpd.ini file in SilverStripe root directory and make its contents like that (what it basically does with ISAPI/Rewrite is to mimic Apache’s mod_rewrite):

[ISAPI_Rewrite] RewriteEngine On

RewriteCond URL (?!.*gif|.*jpg|.*png|.*swf|.*xml|.*css|.*flv|.*js|.*php).*
RewriteCond URL (?!.*\?).*
RewriteRule (.*) /sapphire/main.php\?url=$1 [I,L]

RewriteCond URL (?!.*gif|.*jpg|.*png|.*swf|.*xml|.*css|.*flv|.*js|.*php).*
RewriteCond URL .*\?.*
RewriteRule (.*)\?(.*) /sapphire/main.php\?url=$1&$2 [I,L]

5. Click „click here to proceed anyway” link and You should be redirected to an ugly looking „successfully installed” page.
6. Now edit /sapphire/core/control/Director.php file and change

$s = (isset($_SERVER[‚SSL’]) || isset($_SERVER[‚HTTPS’])) ? ‚s’ : ”;

line to

$s = (isset($_SERVER[‚SSL’]) || (isset($_SERVER[‚HTTPS’]) && $_SERVER[‚HTTPS’] == ‚on’)) ? ‚s’ : ”;

7. Refresh the „successfully installed” page and if it looks pretty now, You know You correctly did step 6.
8. Click „Click here to delete the install files.” link so You don’t have a security hole.
9. Now edit /sapphire/main.php file and at the very beginning add these lines:

if (!isset($_SERVER[‚REQUEST_URI’])) {
$_SERVER[‚REQUEST_URI’] = $_SERVER[‚SCRIPT_NAME’];
}

10. Following are hacks I needed to add so i18n works on IIS. If You don’t use i18n, You’ll probably be fine without these hacks. This method is in sapphire/core/i18n.php file:

protected static function get_owner_module($name) {
if (substr($name,-3) == ‚.ss’) {
global $_TEMPLATE_MANIFEST;
$path = current($_TEMPLATE_MANIFEST[substr($name,0,-3)]);
// hacks for IIS start –>
$path = str_replace(‚\sapphire/..’, ”, $path);
$path = str_replace(‚C:’, ”, $path);
$path = str_replace(‚\’, ‚/’, $path);
$bf = Director::baseFolder();
$bf = str_replace(‚C:’, ”, $bf);
$bf = str_replace(‚\’, ‚/’, $bf);
// <-- end hacks
ereg($bf . ‚/([^/]+)/’,$path,$module);
} else {
global $_CLASS_MANIFEST;
$path = $_CLASS_MANIFEST[$name];
// hacks for IIS start –>
$path = str_replace(‚\sapphire/..’, ”, $path);
$path = str_replace(‚C:’, ”, $path);
$path = str_replace(‚\’, ‚/’, $path);
$bf = Director::baseFolder();
$bf = str_replace(‚C:’, ”, $bf);
$bf = str_replace(‚\’, ‚/’, $bf);
// <-- end hacks
ereg($bf . ‚/([^/]+)/’,$path,$module);
}
return $module[1];
}

11. Enjoy 🙂
12. If You can’t enjoy for some reason, try checking out this thread at SilverStripe forum where most of the above info is found.

6 myśli nt. „[en] Installing SilverStripe on IIS server

  1. Hi: I use this manual and it wotks fine, but i change httpd.ini to:

    RewriteEngine On RewriteCond %{REQUEST_URI} !(.gif)|(.jpg)|(.png)|(.css)|(.js)|(.php)$ RewriteCond URL (?!.?). RewriteRule (.*) /sapphire/main.php?url=$1 [I,L]

    because, with the your configuration SS can´t read the css files and image paths.

    My problem is that i can´t access to administration, it says:

    FATAL ERROR: None of these templates can be found: Security_dologin.ss, Security.ss At line 68 in C:InetpubwwwrootsapphirecoreSSViewer.php

    Anybody has the same problem?

  2. This is the right web site for anyone wwho wants to find out about this topic. You realize a whole lot its almost tough to argue with you (not that I actually would want to…HaHa). You definitely put a brandd neew spin on a subject that’s been discussed for a long time. Great stuff, just excellent!

  3. The next time I read a blog, Hopefully it won’t disappoint me as much as this particular one.

    After all, I know it was my choice to read through, nonetheless I genuinely thought you would have something useful to say. All I hear is a bunch of crying about something that you could fix if you weren’t too busy looking for attention.

  4. This design is incredible! You most certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Great job. I really loved what you had to say, and more than that, how you presented it. Too cool!

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *