We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31053
    • 31 Posts
    Hi!
    I have MODx Revolution 2.0.8-pl
    I have external php file, with modx api included : http://sunlight-voyage.ru/core/ajax/test.php
    Code inside:
    require_once  dirname(dirname(dirname(__FILE__))).'/config.core.php';
    require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
    require_once MODX_CORE_PATH.'model/modx/modx.class.php';
    $modx = new modX();
    $modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
    $modx->log(modX::LOG_LEVEL_DEBUG, 'API START', 'HTML', 'ajax/modx_api'); 
    $modx->initialize('web');
    $test = $modx->getObject('modResource', array('id'=>1));
    if(is_null($test)) echo 'NULL';
    else echo 'ok';
    $modx->log(modX::LOG_LEVEL_DEBUG, 'API END', 'HTML', 'ajax/modx_api'); 
    


    It’s work perfect, if I not loged in. But If I login to manager, this script return HTTP error 502.

    Same script, on the same Modx, but on another server works fine.

    Log is empty, $modx->initialize(’mgr’) - not work, CHMODE - fine.
    What’s problem.

    PS.: Now this script send mail. Mails come ok, but still куегкт 502.

    Thank you.
      for($i=0; $i<100; $i++) echo &#39;Why is it not working?&#39;;