using name based virtual hosting on Apache Web Server.
** Setup
** Symptom
** Workaround / Fix
** Additional potential problems
Physical Directory Structure in hosting account
-----------------------------------------------
Code: Select all
1st S9Y installation:
/home/user2/hmtl (root directory for domain1.com)
/home/user2/hmtl/blog/ (S9Y 1.1.2 blog for domain1.com
blog1)
2nd S9Y installation:
/home/user2/html/domain2/ (directory for domain2.net)
/home/user2/html/domain2/blog/ (S9Y 1.2 blog for domain2.net
blog2)
Symptom after installing S9Y for www .domain2.net/blog/
------------------------------------------------------
URL: http://www .domain2.net/blog/
Output: "Serendipity has detected that your currently installed Serendipity version is 1.1.2. It seems you are attempting to upgrade to version 1.2, so you need to click here to continue the upgrade process."
The local config file of Blog1 is loaded. That's the problem.
/home/user2/hmtl/blog/serendipity_config_local.inc.php
Having either blogs on differently named path like /blog/ and /blog2/
or calling the blog with a subdomain (needs to be configured a bit differently
with the blog in the root of the subdomain instead of a path) solved the
problem. But hey, who want a blog at /blog2?
Nobody.
WORKAROUND / FIX
-----------------
File: serendipity_config.inc.php
Version: # $Id: serendipity_config.inc.php 1871 2007-08-25 12:07:56Z garvinhicking $
Line: 222 (or close, I already added comments into my personal version, sorry)
Code: Select all
if (file_exists($_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/serendipity_config_local.inc.php')) {
$local_config = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/serendipity_config_local.inc.php';
} elseif (defined('S9Y_DATA_PATH')) {
...
$_SERVER['DOCUMENT_ROOT'] is the physical root of all hosts, and name based virtual hosts
at least in my hosting account. E.g. in my example.
$_SERVER['DOCUMENT_ROOT'] is "/home/user2/hmtl" for domain1.com and domain2.net, and any others
Every use of $_SERVER['DOCUMENT_ROOT'] in the whole S9Y Software could
be wrong in those kind of setups. I did not observe any other problems so far.
So I fixed it by commenting the first test out like this.
Code: Select all
if ( false ) { /*file_exists($_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/serendipity_config_local.inc.php')) {
$local_config = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/serendipity_config_local.inc.php'; */
} elseif (defined('S9Y_DATA_PATH')) {
...
------------------------------
I did a grep in the 1.2 tree to see, where else 'DOCUMENT_ROOT' is used.
Code: Select all
grep "_SERVER\['DOCUMENT_ROOT'\]" -Rc * | grep -v :0
bundled-libs/Text/Wiki/Render/Xhtml/Image.php:1
include/functions_installer.inc.php:3
serendipity_config.inc.php:2
Maybe it's not too much of an effort to fix this
in the V1.3 Beta
Yours
John