[en] Installing SilverStripe on IIS server

UPDATE 2009-02-17: As Sigurd from Silver­Stri­pe team sta­tes in a com­ment, You sho­uld­n’t need to fol­low my „how­to” — at least if You’re using IIS 7. Sin­ce I wro­te this „how­to”, Silver­Stri­pe websi­te has been impro­ved to inc­lu­de instal­la­tion instruc­tions on IIS so ple­ase give it a try befo­re pro­ce­eding with my old instructions.

1. Install ISAPI/Rewrite. I have no idea how to do it sin­ce it was alre­ady instal­led at my pro­vi­de­r’s server, but the­re pro­ba­bly is a limi­ted free ver­sion that is enough.
2. Down­lo­ad Silver­Stri­pe archi­ve and extract it to Your server.
3. Go to Your serve­r’s URL and fill in instal­ler deta­ils as usual.
4. After rew­ri­te­test fails, cre­ate httpd.ini file in Silver­Stri­pe root direc­to­ry and make its con­tents like that (what it basi­cal­ly does with ISAPI/Rewrite is to mimic Apa­che­’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 pro­ce­ed any­way” link and You sho­uld be redi­rec­ted to an ugly looking „suc­cess­ful­ly instal­led” 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 „suc­cess­ful­ly instal­led” page and if it looks pret­ty now, You know You cor­rec­tly did step 6.
8. Click „Click here to dele­te the install files.” link so You don’t have a secu­ri­ty hole.
9. Now edit /sapphire/main.php file and at the very begin­ning add the­se lines:

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

10. Fol­lo­wing are hacks I needed to add so i18n works on IIS. If You don’t use i18n, You’ll pro­ba­bly be fine witho­ut the­se hacks. This method is in sapphire/core/i18n.php file:

pro­tec­ted sta­tic func­tion get_owner_module($name) {
if (substr($name,-3) == ‘.ss’) {
glo­bal $_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 {
glo­bal $_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 chec­king out this thre­ad at Silver­Stri­pe forum whe­re most of the abo­ve info is found.

6 komentarz do “[en] Installing SilverStripe on IIS server

  1. Hi: I use this manu­al and it wotks fine, but i chan­ge httpd.ini to:

    Rew­ri­te­En­gi­ne On Rew­ri­te­Cond %{REQUEST_URI} !(.gif)|(.jpg)|(.png)|(.css)|(.js)|(.php)$ Rew­ri­te­Cond URL (?!.?). Rew­ri­te­Ru­le (.*) /sapphire/main.php?url=$1 [I,L]

    becau­se, with the your con­fi­gu­ra­tion SS can´t read the css files and ima­ge paths.

    My pro­blem is that i can´t access to admi­ni­stra­tion, it says:

    FATAL ERROR: None of the­se tem­pla­tes can be found: Security_dologin.ss, Secu​ri​ty​.ss At line 68 in C:InetpubwwwrootsapphirecoreSSViewer.php

    Any­bo­dy has the same problem?

  2. This is the right web site for any­one wwho wants to find out abo­ut this topic. You reali­ze a who­le lot its almost tough to argue with you (not that I actu­al­ly would want to…HaHa). You defi­ni­te­ly put a brandd neew spin on a sub­ject tha­t’s been discus­sed for a long time. Gre­at stuff, just excellent!

  3. The next time I read a blog, Hope­ful­ly it won’t disap­po­int me as much as this par­ti­cu­lar one.

    After all, I know it was my cho­ice to read thro­ugh, none­the­less I genu­ine­ly tho­ught you would have some­thing use­ful to say. All I hear is a bunch of cry­ing abo­ut some­thing that you could fix if you were­n’t too busy looking for attention.

  4. Hi to all, it’s genu­ine­ly a good for me to visit this web site, it inc­lu­des impor­tant Information.

  5. This design is incre­di­ble! You most cer­ta­in­ly know how to keep a reader enter­ta­ined. Betwe­en your wit and your vide­os, I was almost moved to start my own blog (well, almost…HaHa!) Gre­at job. I real­ly loved what you had to say, and more than that, how you pre­sen­ted it. Too cool!

Możliwość komentowania została wyłączona.