Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-02-20 03:09:35
- ajw-art
- Member
- Registered: 2010-02-10
- Posts: 33
Help with the older multi-site method.
In this post I was having trouble setting up a site with symlinks on 1&1. It became apparent that they had no idea what symlinks were, and other shared hosts I called didn’t offer the feature at all. I decided to try the older method of getting multi-site to work, which involved installing textpattern in each site folder, changing the txpath in the config.php file to point to the root’s textpattern folder, and deleting all extra files afterward. ( More here)
Now I’ve run into a new problem. I followed the directions:
- Now go and edit airweek2006/textpattern/index.php:
- There’s a define() on ± line 20 that says define(“txpath”, dirname(__FILE__));
- Change this to say: define(“txpath”, $txpcfg[‘txpath’]);
- Move this define to ± line 32 after the code that include()‘s config.php
And the site is now cheerfully spewing PHP error after PHP error at me, nearly all of them because the site is still trying to include (now deleted) files from its current location and not pulling the files from the root. I know nothing about PHP, so I’m at a loss. Has something changed since those instructions were written to make this method obsolete?
Here’s my current textpattern/index.php for the subdomain, if it helps.
if (@ini_get('register_globals'))
foreach ( $_REQUEST as $name => $value )
unset($$name);
if (!defined('txpath'))
{
define("txpath", $txpcfg['txpath']);
}
define("txpinterface", "admin");
$thisversion = '4.2.0';
$txp_using_svn = false; // set false for releases
ob_start(NULL, 2048);
if (!isset($txpcfg['table_prefix']) && !@include './config.php') {
define("txpath", $txpcfg['txpath']);
ob_end_clean();
header('HTTP/1.1 503 Service Unavailable');
exit('config.php is missing or corrupt. To install Textpattern, visit <a href="./setup/">setup</a>.');
} else ob_end_clean();
Last edited by ajw-art (2010-02-20 03:33:23)
Offline
Re: Help with the older multi-site method.
ajw-art wrote:
In this post I was having trouble setting up a site with symlinks on 1&1. It became apparent that they had no idea what symlinks were, and other shared hosts I called didn’t offer the feature at all.
Not answering your main question(s), but what you need is a shared host that offers SSH access. I recently converted several sites to multi-site on Dreamhost.
Code is topiary
Offline
#3 2010-02-20 13:46:59
- ajw-art
- Member
- Registered: 2010-02-10
- Posts: 33
Re: Help with the older multi-site method.
The host I’m using actually does offer SSH access for a one-time fee; however, this is for a client, one with a small organization at that, and I was trying to avoid tacking on any extra costs if possible.
Would symlinks work with SSH, or would that enable a different method to work?
Offline
Re: Help with the older multi-site method.
That is, if it is Unix/Linux based hosting and you have shell access, you can make the symlinks yourself.
Code is topiary
Offline
#5 2010-02-20 14:29:42
- ajw-art
- Member
- Registered: 2010-02-10
- Posts: 33
Re: Help with the older multi-site method.
It is Linux based. So, just for clarification— I apologize for the questions, I’ve never tried multi-site with TXP before, so I’ve never had to do this much fussing with the back end— SSH would enable the symlinks included in the TXP sites folder to work by providing an alternate path that doesn’t depend on httpd.conf?
Offline
Re: Help with the older multi-site method.
It would enable you to replace any broken symlinks with working ones. Copying or uploading the sites folder via FTP (or file system overlay such as the OS X Finder) may break symlinks.
Code is topiary
Offline
#7 2010-02-20 14:51:57
- ajw-art
- Member
- Registered: 2010-02-10
- Posts: 33
Re: Help with the older multi-site method.
But from a server perspective, would traversing symlinks still have to be enabled? The fact that traversing symlinks isn’t enabled on the host I’m using was the reason why I’d switch to the older method.
Offline
Re: Help with the older multi-site method.
OK, sorry, if symlinks are disabled you still might be able to enable them by uncommenting the
Options +FollowSymLinks
line in .htaccess. If that doesn’t work you might try
Options +SymLinksIfOwnerMatch
instead.
Code is topiary
Offline
#9 2010-02-20 15:38:09
- ajw-art
- Member
- Registered: 2010-02-10
- Posts: 33
Re: Help with the older multi-site method.
I’d tried that, and when it didn’t work I spoke with the host and they informed me that the current multi-site method won’t work on their server because they don’t allow traversing symbolic links, period. It’s why I switched to the older multi method; it doesn’t require symlinks.
My problem now is that these lines in the instructions:
- Change this to say: define(“txpath”, $txpcfg[‘txpath’]);
- Move this define to ± line 32 after the code that include()‘s config.php
don’t specify how to format define(“txpath”, $txpcfg[‘txpath’]); when I go to enter it on line 32, or where exactly after the include to place it. I know nothing about PHP, so every combination I’ve tried has gotten me nothing but Warning: include( blah blah blah…) errors because it’s still trying to find files in its current directory rather than pulling them from the primary installation. I’m completely lost.
Below are lines 32 – 36 of the PHP code in question. If you happen to know the proper way to insert define(“txpath”, $txpcfg[‘txpath’]); here, I’d be grateful.
if (!isset($txpcfg['table_prefix']) && !@include './config.php' ) {
ob_end_clean();
header('HTTP/1.1 503 Service Unavailable');
exit('config.php is missing or corrupt. To install Textpattern, visit <a href="./setup/">setup</a>.');
} else ob_end_clean();
Last edited by ajw-art (2010-02-20 15:39:23)
Offline
Re: Help with the older multi-site method.
Cut the
if (!defined('txpath'))
block (lines 20-23, inclusive) and paste it into the line after
bc.} else ob_end_clean();
(i.e., paste into line 36).
Code is topiary
Offline
#11 2010-02-20 16:40:17
- ajw-art
- Member
- Registered: 2010-02-10
- Posts: 33
Re: Help with the older multi-site method.
Oooh! I was reading the directions wrong. I thought it just wanted me to move the define(“txpath”, $txpcfg[‘txpath’]); line down there, not the entire code block.
Unfortunately, I’m still getting Warning: include() [function.include]: Failed opening errors, all of them because it’s trying to find files in it’s own directory. It’s like index.php is completely ignoring the $txpcfg[‘txpath’] I’ve set in config.php
Here’s the full index.php code. Am I still doing something wrong?
<?php
/*
This is Textpattern
Copyright 2005 by Dean Allen
www.textpattern.com
All rights reserved
Use of this software indicates acceptance of the Textpattern license agreement
$HeadURL: https://textpattern.googlecode.com/svn/releases/4.2.0/source/textpattern/index.php $
$LastChangedRevision: 3275 $
*/
if (@ini_get('register_globals'))
foreach ( $_REQUEST as $name => $value )
unset($$name);
define("txpinterface", "admin");
$thisversion = '4.2.0';
$txp_using_svn = false; // set false for releases
ob_start(NULL, 2048);
if (!isset($txpcfg['table_prefix']) && !@include './config.php' ) {
ob_end_clean();
header('HTTP/1.1 503 Service Unavailable');
exit('config.php is missing or corrupt. To install Textpattern, visit <a href="./setup/">setup</a>.');
} else ob_end_clean();
if (!defined('txpath'))
{
define("txpath", $txpcfg['txpath']);
}
header("Content-type: text/html; charset=utf-8");
if (isset($_POST['form_preview'])) {
include txpath.'/publish.php';
textpattern();
exit;
}
error_reporting(E_ALL);
@ini_set("display_errors","1");
include_once txpath.'/lib/constants.php';
include txpath.'/lib/txplib_misc.php';
include txpath.'/lib/txplib_db.php';
include txpath.'/lib/txplib_forms.php';
include txpath.'/lib/txplib_html.php';
include txpath.'/lib/txplib_theme.php';
include txpath.'/lib/admin_config.php';
$microstart = getmicrotime();
if ($connected && safe_query("describe `".PFX."textpattern`")) {
$dbversion = safe_field('val','txp_prefs',"name = 'version'");
// global site prefs
$prefs = get_prefs();
extract($prefs);
if (empty($siteurl))
$siteurl = $_SERVER['HTTP_HOST'] . rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), '/');
if (empty($path_to_site))
updateSitePath(dirname(dirname(__FILE__)));
define("LANG",$language);
//i18n: define("LANG","en-gb");
define('txp_version', $thisversion);
if (!defined('PROTOCOL')) {
switch (serverSet('HTTPS')) {
case '':
case 'off': // ISAPI with IIS
define('PROTOCOL', 'http://');
break;
default:
define('PROTOCOL', 'https://');
break;
}
}
define("hu",PROTOCOL.$siteurl.'/');
// v1.0 experimental relative url global
define("rhu",preg_replace("/https?:\/\/.+(\/.*)\/?$/U","$1",hu));
if (!empty($locale)) setlocale(LC_ALL, $locale);
$textarray = load_lang(LANG);
// init global theme
$theme = theme::init();
include txpath.'/include/txp_auth.php';
doAuth();
// once more for global plus private prefs
$prefs = get_prefs();
extract($prefs);
$event = (gps('event') ? gps('event') : (!empty($default_event) && has_privs($default_event) ? $default_event : 'article'));
$step = gps('step');
$app_mode = gps('app_mode');
if (!$dbversion or ($dbversion != $thisversion) or $txp_using_svn)
{
define('TXP_UPDATE', 1);
include txpath.'/update/_update.php';
}
janitor();
if (!empty($admin_side_plugins) and gps('event') != 'plugin')
load_plugins(1);
// plugins may have altered privilege settings
if (!gps('event') && !empty($default_event) && has_privs($default_event))
{
$event = $default_event;
}
// init private theme
$theme = theme::init();
include txpath.'/lib/txplib_head.php';
// ugly hack, for the people that don't update their admin_config.php
// Get rid of this when we completely remove admin_config and move privs to db
if ($event == 'list')
require_privs('article');
else
require_privs($event);
callback_event($event, $step, 1);
$inc = txpath . '/include/txp_'.$event.'.php';
if (is_readable($inc))
include($inc);
callback_event($event, $step, 0);
$microdiff = (getmicrotime() - $microstart);
echo n.comment(gTxt('runtime').': '.substr($microdiff,0,6));
end_page();
} else {
txp_die('DB-Connect was succesful, but the textpattern-table was not found.',
'503 Service Unavailable');
}
?>
Offline
Re: Help with the older multi-site method.
ajw-art wrote:
Unfortunately, I’m still getting Warning: include() [function.include]: Failed opening errors, all of them because it’s trying to find files in it’s own directory. It’s like index.php is completely ignoring the $txpcfg[‘txpath’] I’ve set in config.php
Obviously it is finding config.php, otherwise you would get the “missing or corrupt” message. Are you sure the txpath
you have set in config.php is correct? Does it correspond to the start of the file paths you are seeing in the include()
error messages?
Code is topiary
Offline