I'm following ModX: The Official Guide Ch9: Site Organization and Contexts, trying to create two contexts in the same ModX install. I'm using two different domains on the same server, call them www.aaa.com and www.bbb.com. www.aaa.com already exists and has the ModX install in it. www.bbb.com is in its own vhosts folder, and has index.php and config.core.php from www.aaa.com copied to its root, as per the instructions in the book. Problem is, www.bbb.com keeps throwing a 503 error. I've tracked it down to this code in index.php:
/* include the modX class */
if (!@include_once (MODX_CORE_PATH . "/model/modx/modx.class.php")) {
$errorMessage = 'Site temporarily unavailable';
@include(MODX_CORE_PATH . 'error/unavailable.include.php');
header('HTTP/1.1 503 Service Unavailable');
echo "<html><title>Error 503: Site temporarily unavailable</title><body><h1>Error 503</h1><p>{$errorMessage}</p$
exit();
}
In other words, it's not able to include the modx.class.php file from aaa.com. I did a die statement on `MODX_CORE_PATH . "/model/modx/modx.class.php"` on both sites and they come back with the same path. Is this a CORS issue? I've tried adding an AC Allow Origin header to both files in www.bbb.com to no avail. Any help would be greatly appreciated.
Thanks!
Make sure the path in config.core.php is a full path rather than a relative one.
Also, on the bbb.com site, check the paths and URLs in the core/config/config.inc.php file.
Hi Bob,
The config.core.php file does have a full path. There is no core/config/config.inc.php file however. I am trying to emulate what you did in Ch 9 of MODX: The Official Guide, in the Two Contexts, Two Directories section. So the only contents in the httpdocs folder of bbb.com are index.php and config.core.php, copied from aaa.com!
It could possibly be a CORS issue. I tested it on localhost where that probably wouldn't be an issue. TBH, I tend to avoid using multiple front-end contexts if at all possible, just because of issues like this.
In theory, if that config.core.php file is correct (which it must be if the other site works), the index.php file should find the MODX class file with no trouble. You might try taking out the @ and making it 'require_once' instead of 'include' to see if you get a more meaningful error message. Also, adding this just above that line would tell you if the core path is getting through:
echo '<h3>MODX CORE PATH: ' . MODX_CORE_PATH . '</h3>';
[ed. note: BobRay last edited this post 11 years, 6 months ago.]
-
☆ A M B ☆
- 24,524 Posts
echo '<h3>MODX CORE PATH: ' . MODX_CORE_PATH . '</h3>';
I'm glad to hear you got it sorted. Thanks for reporting back.