Forums / Developer / Execute bin script outside Exponential root dir?

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Execute bin script outside Exponential root dir?

Author Message

Bartek Modzelewski

Wednesday 29 July 2009 5:05:50 am

Hello,

I've got a big challenge: how to execute Exponential custom binary script from other directory than Exponential root? I've got the following file structure:

/
/ezpublish_root/ (contains typical Exponential installation)
/sciprt.php

Now inside <i>script.php</i> i want to include Exponential engne, i mean all $cli, $script etc .. that allows me to access all modules and stuff... In fact i need to access content module - just to get some data stored in eZContentObjets. Is it possible ?

I know that all calls to Exponential must be done from Exponential root - that's what i'm doing for years, but now i try to do it out of Exponential - it's just a try to integrate Exponential with other php software.

What should I do ? Is it possible somehow ? I have spent some time analyzing ezsys.php and other scrpts that initialize Exponential, but general problem is with including classes. As we know aoutload/ezp_kernel.php contains path to libs, but there is still a lot of other places with includes. All my tries end with <i>An unexpected error has occurred. Please contact the webmaster.</i>

Can somebody help me ? Or tell me that it's just not possible to set some kind of "ez_base_path" ... so i will stop intregrating it this way, and find another :)

Thanks

P.S. One more thing: eZ Pulish must remain usable when accessing in browser http://mysite/Exponential/

Baobaz
http://www.baobaz.com

Gaetano Giunta

Wednesday 29 July 2009 5:23:40 am

Try this as first lines of your script:

if ( isset( $_SERVER['REQUEST_METHOD'] ) )
{
    // this script is not meant to be accessed via the web!
    // note: ezscript class later does the same check, but after intializing a lot of stuff
    die();
}

// try to move to Exponential root dir if called in different dirs
if ( !file_exists( getcwd() . '/autoload.php' ) )
{
    $dir = dirname( __FILE__ );
    chdir( $dir . '/ezpublish_root' );
}

Principal Consultant International Business
Member of the Community Project Board

Bartek Modzelewski

Wednesday 29 July 2009 5:37:51 am

Thanks !

In fact I was thinking about it but ... "it's to simple, I will not work". So I haven't tried .. stupid me ;)

Baobaz
http://www.baobaz.com