OK so basically I'd like to load the EE framework and its container outside of an ExpressionEngine path... I know there's been some questions about this, but I haven't found a great answer, and it seems like a good question for the forum. I, like, never ask questions so why not?

Given this simple situation (EE 2.9+):

Web root and ExpressionEngine root: /web_root/index.php

Outside of EE file: /web-root/random-folder/index.php

Is there some way I can initialize the framework in that /random-folder/index.php file? I specifically want to load the database class (and possibly a few others). I know I can probably load CI classes just fine, which is close, but I don't know how it would work with trying to launch the framework there for class use from the ee() container (think ee()->functions, ee()->db, etc..). I know I could probably figure this out on my own, but I rarely have a really good question, so I'm accepting answers, suggestions, as well as warnings against this idea. If anyone has accomplished this successfully, I'd love to hear about it, and am extra inviting to security questions and concerns. Thanks to any who have any ideas.

P.S. Yes, I can do everything I want to in that /random-folder/index.php file in pure PHP, but this is related to an addon development and I'd like that file's contents to have the code structure and feel of an ExpressionEngine addon file.

  • Your "Outside file root" is inside your EE root, just a sub folder - did you mean "/random-folder/index.php" not "/web-root/random-folder/index.php"? So basically you have a non-EE website that you'd like to call classes from the EE website? – Peter Lewis Oct 17 '15 at 12:48
  • Oh yeah I said that wrong. The folder is in the web root, so PHP does get executed. And yes, exactly, call EE classes in a PHP file where EE isn't in play. – jrothafer Oct 17 '15 at 16:26
  • @PeterLewis Sorry I commented but forgot to @ you. – jrothafer Oct 18 '15 at 21:33

Your Answer


Browse other questions tagged or ask your own question.