Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe

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

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

ScriptAlias


Go to End
Reply

9 Posts   3052 Views

Avatar
Mo

11 November 2009 at 10:09pm Community Member, 509 Posts

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

Avatar
banal

11 November 2009 at 11:29pm Community Member, 901 Posts

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.

Avatar
Mo

12 November 2009 at 12:17am Community Member, 509 Posts

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.

Avatar
banal

12 November 2009 at 12:27am Community Member, 901 Posts

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.

Avatar
Mo

12 November 2009 at 12:37am Community Member, 509 Posts

I was talking about Debug::log_errors_to();

Avatar
banal

12 November 2009 at 12:44am (Last edited: 12 November 2009 1:09am), Community Member, 901 Posts

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)

Avatar
Mo

12 November 2009 at 1:26am Community Member, 509 Posts

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 :).

Avatar
banal

12 November 2009 at 1:53am Community Member, 901 Posts

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

Go to Top