I've got an application using regular php scripts and I'd like MODX Revolution to have access to the $_SESSION data.
I've created a test script
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once 'config.core.php';
require_once MODX_CORE_PATH.'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->getService('error', 'error.modError');
//set the session variable
$_SESSION['external'] = "hello";
?>
On the target server I'm not getting to first base with error
Catchable fatal error: Argument 1 passed to xPDOObject::load() must be an instance of xPDO, instance of modX given in /var/www/vhosts/domain/httpdocs/core/xpdo/om/xpdoobject.class.php on line 404
Saw some posts about APC, which this server has, so tried script on a server without APC and there was no error. However I was unable to see my session variable in MODX.
2 questions then
- Is launching MODX from an external script impossible if running APC?
- How do I see my session variable. In MODX I had a snippet print_r($_SESSION); which displays loads of stuff but I couldn't see $_SESSION['external'] = "hello". Regardless of APC is my approach flawed?