add the magento library folder to include the path in index.php:
//define shortcut for DIRECTORY_SEPARATOR defined('DS') || define('DS', DIRECTORY_SEPARATOR); //define base bath obtainable throughout the whole application defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__) . DS . '..' . DS . 'basedir' . DS)); //define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', BASE_PATH . DS . 'app'); //set include path to libraries set_include_path(BASE_PATH . DS . 'library' . PATH_SEPARATOR . MAGENTO_DIR . DS . 'lib' . PATH_SEPARATOR . get_include_path());
But with this approach, you cannot use the latest version of ZF. Therefore, a separate installation is my choice.
autoloader works, an easy way is to place the original Zend / Loader / in your application library or enable all the necessary autoloader classes manually (only 3: loader, autoloader, Zend_Exception)
Here is my full projectName / public / index.php:
if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); $_REQUEST = array_map('stripslashes_deep', $_REQUEST); } //define shortcut for DIRECTORY_SEPARATOR defined('DS') || define('DS', DIRECTORY_SEPARATOR); //define base bath obtainable throughout the whole application defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__) . DS . '..' . DS . 'basedir')); //define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', BASE_PATH . DS . 'app'); //set include path to libraries set_include_path(BASE_PATH . DS . 'library' . PATH_SEPARATOR . get_include_path()); //bootstrap, and run application try { require_once 'Zend/Application.php'; //create application and configure it. $application = new Zend_Application( getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production', array('config' => array(APPLICATION_PATH . DS . 'configs' . DS . 'application.ini')) ); //run application $application->bootstrap()->run(); } catch (Exception $e) { //here was logging logic }
Here is what your /localsite/fbtest/public/index.php looks like:
if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); $_REQUEST = array_map('stripslashes_deep', $_REQUEST); } //define shortcut for DIRECTORY_SEPARATOR defined('DS') || define('DS', DIRECTORY_SEPARATOR); //define base bath obtainable throughout the whole application //keep your libraries and application out of public directory defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__) . DS . '..' . DS . 'basedir')); //define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', BASE_PATH . DS . 'application'); //if index.php in /localsite/fbtest/public/ defined('MAGENTO_PATH') || define('MAGENTO_PATH', realpath(dirname(__FILE__) . DS . '..' . DS . '..' . DS . 'products')); //set include path to libraries //noticed magento library added? set_include_path(BASE_PATH . DS . 'library' . PATH_SEPARATOR . MAGENTO_PATH . DS . 'lib' . PATH_SEPARATOR . get_include_path()); //bootstrap, and run application try { require_once 'Zend/Application.php'; require_once 'Zend/Loader.php'; require_once 'Zend/Loader/Autoloader.php'; require_once 'Zend/Exception.php'; //create application and configure it. $application = new Zend_Application( getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production', array('config' => array(APPLICATION_PATH . DS . 'configs' . DS . 'application.ini')) ); //run application $application->bootstrap()->run(); } catch (Exception $e) { //here was logging logic }