I'm beginner with Zend technology and I have a problem when I run the project I get this error:
Warning: require_once(Zend/Loader/Autoloader.php):
failed to open stream:
No such file or directory in C:\xampp\htdocs\jcma\public\index.php on line 55
Fatal error: require_once():
Failed opening required 'Zend/Loader/Autoloader.php' (include_path=';C:\xampp\htdocs\jcma\public\../../httpdocs/ZendFramework/library;C:\xampp\htdocs\jcma\public\../application/classes;C:\xampp\htdocs\jcma\public\../application/library/dompdf;C:\xampp\htdocs\jcma\public\../application/library/cmcic;.;C:\xampp\php\PEAR')
in C:\xampp\htdocs\jcma\public\index.php on line 55
Using ZF1 standard structure, we usually copy Zend Framework in the library folder and then enable the Autoloader.
I will only put examples from the standard structure below, and then let's discuss them and adapt to your specifics.
Here is the application/configs/application.ini from one of my old projects:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
The focus here is the following line:
includePaths.library = APPLICATION_PATH "/../library"
You also need to check your public/index.php:
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
Here the set_include_path is what you want to verify. If this is well configured, you should not have any error.
From your error message, there is a configuration problem here.
Fatal error: require_once(): Failed opening required 'Zend/Loader/Autoloader.php' (include_path=';C:\xampp\htdocs\jcma\public../../httpdocs/ZendFramework/library;C:\xampp\htdocs\jcma\public../application/classes;C:\xampp\htdocs\jcma\public../application/library/dompdf;C:\xampp\htdocs\jcma\public../application/library/cmcic;.;C:\xampp\php\PEAR') in C:\xampp\htdocs\jcma\public\index.php on line 55
See the bold text above: the first should be C:\xampp\htdocs\jcma\ZendFramework\library I guess, and the library should be located in this folder.
Can you copy paste a tree of your folders under C:\xampp\htdocs\ or at least describe the major directories, and paste your index.php?
It works for me very well. Look at inside:
application/configs/application.ini
[production]
includePaths.library = APPLICATION_PATH "/../library"
Point the path after APPLICATION_PATH to Zend Framework unpackaged folder. And the other option copy the /library/ which includes Zend folder inside to the same level of the project folder.