Jump to:

4952 Posts in 14381 Topics by 1491 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » ScriptAlias

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 2989 Views
  • Mo
    Avatar
    Community Member
    505 Posts

    ScriptAlias Link to this post

    Hi All,

    Quick question. I am trying to automate my deployment process a bit. One thing I am trying to do is make the core silverstripe codebase available to each virtual host on my server through ScriptAlias in my apache config, like this:

    ScriptAlias /sapphire /var/www/silverstripe/2.3.3/sapphire
    ScriptAlias /cms /var/www/silverstripe/2.3.3/cms
    ScriptAlias /jsparty /var/www/silverstripe/2.3.3/jsparty

    Trouble is, because the .htaccess directs to sapphire/main.php, I am having trouble getting Apache to execute this file from an aliased directory. Anyone done this or have any ideas?

    Cheers,

    Mo

  • banal
    Avatar
    Community Member
    901 Posts

    Re: ScriptAlias Link to this post

    Hi Mo

    I'm using symbolic links for local development. Meaning: I have a SilverStripe 2.3.3 codebase and all it's folders (cms, sapphire, etc.) are being symlinked into all my projects.
    I even created a shell script that automatically creates a new folder, creates the links, the database and runs /dev/build

    If you have access to a shell on your server, then this is probably the better solution.

  • Mo
    Avatar
    Community Member
    505 Posts

    Re: ScriptAlias Link to this post

    I tried to use sym links a well, they worked for the most part, but I get an issue with generating an error log. Debug doesn't seem to like being located outside the site route. Keeps saying it cant locate my error log file :s.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: ScriptAlias Link to this post

    That's strange, it works fine here. Are you talking about the apache, or php error log? Can't you set the path for that somewhere?
    The only thing I had to change in the SilverStripe codebase was the Image class, since it used "hard-coded" paths to the asset folder (as described in this post: http://silverstripe.org/general-questions/show/251650?start=24).

    If you wish I can post my shell script here, although it was written for Mac OS X.

  • Mo
    Avatar
    Community Member
    505 Posts

    Re: ScriptAlias Link to this post

    I was talking about Debug::log_errors_to();

  • banal
    Avatar
    Community Member
    901 Posts

    Re: ScriptAlias Link to this post

    And if you put something like this in your /mysite/_config.php:

    Debug::log_errors_to(Director::baseFolder() . '/error.log');

    Should create the log file in your current site root.

    Update: After looking at the Debug class I noticed that Debug::log uses "relative to __FILE__" paths which won't work with symlinks. Are you using Debug::log by any chance?

    Update 2: looks like Debug::log_error_if_necessary is also creating some strange paths. WTF at the following:

    $shortFile = "../" . self::$log_errors_to;

    I guess this wasn't meant to be used with absolute paths. There's room for improvement here, I guess I will submit it as a patch, so that it works with symlinked installs (they already changed the Image class in that respect, so why not do the same for Debug)

    Update 3: Ah. Another update..
    Just had a look at the Debug class in 2.4-alpha1 and saw that the log_errors_to will be replaced with a Wrapper around Zend_Log (SS_Log). That should give much more flexibility (I love Zend_Log) and solve this issue once 2.4 is out. I guess there's no point in patching the old Debug class. I suggest you simply modify the Debug.php file to use paths that work with the symlinked install (Director::baseFolder() comes to mind, or use a defined constant)

  • Mo
    Avatar
    Community Member
    505 Posts

    Re: ScriptAlias Link to this post

    I think we must be sharing a similar brainwave frequency Banal, just done exactly what you suggested .

    I have set my 2.4 test site up to use zend log, I think you are right about it being more flexible .

  • banal
    Avatar
    Community Member
    901 Posts

    Re: ScriptAlias Link to this post

    Hehe cool.
    When using Zend_Log, be sure to check out the FirePHP log-writer. It's awesome:
    http://framework.zend.com/manual/en/zend.log.writers.html#zend.log.writers.firebug

    2989 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.