Bonjour a tous.
J'ai créé une application avec ZF qui fonctionne correctement sous Windows.
J'ai donc essayé de l'installer sur mon serveur Apache sous linux et là problème : mon application ne trouve plus les classes du model. Comme si l'autoload ne fonctionné pas.
Mon architecture est la suivante.
Je voudrais savoir si quelqu'un a une idée pourquoi ça marche sous Windows et pas sous Linux? Si ça vient de mon code? ou d'un module php à charger?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 application-- | controllers forms models-- | DbTable DbView
Si je rajoute des require_once() ça marche mais bon j'aimerais trouver une solution qui ne m'oblige pas à reprendre tous mes fichiers.
Je tiens a préciser que j'ai respecté la convention de nommage des classes (enfin je pense). Par exemple les classes qui sont dans DbTable commence par Application_Model_DbTable_nomdelaclasse.
Mon application.ini
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 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 resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" ; Active la gestion des modules resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.modules[] =
Mon bootstrap
Mon index.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102 <?php /** * Utilisé par la suite */ require_once 'plugins/function.php';//Diverse function require_once 'plugins/Translator.php'; require_once 'plugins/Fpars.php'; class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { /** * @var Zend_Controller_Front */ private $_frontController = null; public function __construct($application) { parent::__construct($application); $this->_frontController = Zend_Controller_Front::getInstance(); /** * remplace certaine valeur du php.ini */ date_default_timezone_set('Europe/Paris'); /** * Force l'encodage en UTF-8 */ setlocale(LC_ALL,"fr_FR.UTF-8"); mb_internal_encoding('UTF-8'); iconv_set_encoding("internal_encoding", "UTF-8"); //header('Content-type: text/html; charset=iso-8859-1'); } protected function _initView(){ $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('Alba_'); $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); //$viewRenderer->setView(new Alba_View_Tidy()); } /** * Pour etre valide XHTML */ protected function _initDoctype() { $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $viewRenderer->initView(); $viewRenderer->view->doctype('XHTML11'); } protected function _initLib() { $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('Alba_'); } protected function _initNavigation() { $this->bootstrap('layout'); $layout = $this->getResource('layout'); $view = $layout->getView(); $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav'); $container = new Zend_Navigation($config); $view->navigation($container); } protected function _initpluginsdb() { $this->_frontController->registerPlugin(new Application_Plugin_Dbinit()); } //copie la config dans le registre protected function _initConfig() { $config = new Zend_Config($this->getOptions()); Zend_Registry::set('config', $config); $db = new Zend_Db_Adapter_Pdo_Mysql($config->resources->db->params); Zend_Db_Table::setDefaultAdapter($db); Zend_Registry::set('db', $db); return $config; } /** * Démmare les acl */ protected function _initAcl() { $acl=new Alba_Acl(); $this->_frontController->registerPlugin(new Alba_Acl_Auth($acl)) ; Zend_Registry::set('acl', $acl); } ?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 <?php defined('INSTALLATION_PATH') || define('INSTALLATION_PATH', realpath(dirname(__FILE__) . '/../')); // 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') : 'development')); // 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' ); //n'affiches pas les erreurs de notice error_reporting(E_ALL ^ E_NOTICE); $application->bootstrap() ->run(); ?>
Merci d'avance
Partager