IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MVC PHP Discussion :

Configuration des erreur dans un fichier ini


Sujet :

MVC PHP

  1. #1
    Membre confirmé
    Avatar de Jcpan
    Inscrit en
    Août 2008
    Messages
    542
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 542
    Points : 475
    Points
    475
    Par défaut Configuration des erreur dans un fichier ini
    Bonjour

    Après avoir crée un projet avec ZendTool j'ai bien eu une stucture sui marche et je suis content .
    Après j'ai voulu faire quelques test, d'où j'ai commencé par les erreurs et j'ai appelé un contrôleur qui n'existe pas.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    http://localhost/zf/public/index1.php
    d'où j'ai eu cette erreur
    An error occurred
    Page not found
    Exception information:
    Message: Invalid controller specified (index1.php)

    Stack trace:
    #0 C:\Server\xampp\htdocs\zf\library\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
    #1 C:\Server\xampp\htdocs\zf\library\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front->dispatch()
    #2 C:\Server\xampp\htdocs\zf\library\Zend\Application.php(358): Zend_Application_Bootstrap_Bootstrap->run()
    #3 C:\Server\xampp\htdocs\zf\public\index.php(26): Zend_Application->run()
    #4 {main} Request Parameters:
    array (
    'controller' => 'index1.php',
    'action' => 'index',
    'module' => 'default',
    )
    jusqu'à la tout va bien puisque c'est programmé.

    Puis j'ai j'ai jeté un coup d'œil dans le fichier 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
    15
    16
    17
    18
    19
     
     
    [production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    includePaths.library = APPLICATION_PATH "/../library"
    bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
    bootstrap.class = "Bootstrap"
    resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
     
    [staging : production]
     
    [testing : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
     
    [development : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    et j'ai suprimmé la ligne [development : production]

    d'où le message d'erreur programmé à disparu et j'ai l'erreur non programmé suivante
    Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'Section 'development' cannot be found in C:\Server\xampp\htdocs\zf\application/configs/application.ini' in C:\Server\xampp\htdocs\zf\library\Zend\Config\Ini.php:150 Stack trace: #0 C:\Server\xampp\htdocs\zf\library\Zend\Application.php(375): Zend_Config_Ini->__construct('C:\Server\xampp...', 'development') #1 C:\Server\xampp\htdocs\zf\library\Zend\Application.php(85): Zend_Application->_loadConfig('C:\Server\xampp...') #2 C:\Server\xampp\htdocs\zf\public\index.php(24): Zend_Application->__construct('development', 'C:\Server\xampp...') #3 {main} thrown in C:\Server\xampp\htdocs\zf\library\Zend\Config\Ini.php on line 150



    sachant que mon fichier index est configuré pour juste version production

    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
    <?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();
    Je ne vois pas d'où viens le probleme est ce que j'ai loupé quelque chose ?
    devlopment est une section par defaut ?

    Merci d'avance.

  2. #2
    Modérateur

    Avatar de MaitrePylos
    Homme Profil pro
    DBA
    Inscrit en
    Juin 2005
    Messages
    5 496
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 496
    Points : 12 596
    Points
    12 596
    Par défaut
    Bonjour,

    regarde ton fichier .htaccess, c'est là je pense que devlopment est défini.

  3. #3
    Membre confirmé
    Avatar de Jcpan
    Inscrit en
    Août 2008
    Messages
    542
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 542
    Points : 475
    Points
    475
    Par défaut
    Merci bien
    En faite je vien de mofier le .htaccess et j'ai changé le development en
    testing

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    SetEnv APPLICATION_ENV testing
    
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    Ce qui est bizarre c'est que le message d'erreur a pris une autre forme


    avec development ca donne ca
    An error occurred
    Page not found
    Exception information:
    Message: Invalid controller specified (index1.php)

    Stack trace:
    #0 C:\Server\xampp\htdocs\zf\library\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
    #1 C:\Server\xampp\htdocs\zf\library\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front->dispatch()
    #2 C:\Server\xampp\htdocs\zf\library\Zend\Application.php(358): Zend_Application_Bootstrap_Bootstrap->run()
    #3 C:\Server\xampp\htdocs\zf\public\index.php(26): Zend_Application->run()
    #4 {main} Request Parameters:
    array (
    'controller' => 'index1.php',
    'action' => 'index',
    'module' => 'default',
    )
    et avec testing ca donne ca



    An error occurred
    Page not found
    alors que la configuration dans application.ini est la même pour les deux

    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
     
     
    [production]
    phpSettings.display_startup_errors = 0
    phpSettings.display_errors = 0
    includePaths.library = APPLICATION_PATH "/../library"
    bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
    bootstrap.class = "Bootstrap"
    resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
     
    [staging : production]
     
    [testing : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
     
    [development : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1

  4. #4
    Modérateur

    Avatar de MaitrePylos
    Homme Profil pro
    DBA
    Inscrit en
    Juin 2005
    Messages
    5 496
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 496
    Points : 12 596
    Points
    12 596
    Par défaut
    et le errorController donne quoi ?

  5. #5
    Membre confirmé
    Avatar de Jcpan
    Inscrit en
    Août 2008
    Messages
    542
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 542
    Points : 475
    Points
    475
    Par défaut
    j'ai pas compris

    voila le fichier ErrorController.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
     
     
    <?php
     
    class ErrorController extends Zend_Controller_Action
    {
     
        public function errorAction()
        {
            $errors = $this->_getParam('error_handler');
     
            switch ($errors->type) { 
                case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
                case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
     
                    // 404 error -- controller or action not found
                    $this->getResponse()->setHttpResponseCode(404);
                    $this->view->message = 'Page not found';
                    break;
                default:
                    // application error 
                    $this->getResponse()->setHttpResponseCode(500);
                    $this->view->message = 'Application error';
                    break;
            }
     
            $this->view->exception = $errors->exception;
            $this->view->request   = $errors->request;
        }
     
     
    }

  6. #6
    Modérateur

    Avatar de MaitrePylos
    Homme Profil pro
    DBA
    Inscrit en
    Juin 2005
    Messages
    5 496
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 496
    Points : 12 596
    Points
    12 596
    Par défaut
    j'essayais de savoir le pourquoi du comment, et c'est pas ça

  7. #7
    Membre actif

    Inscrit en
    Juin 2009
    Messages
    99
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 99
    Points : 228
    Points
    228
    Par défaut
    Bonjour

    c'est tout simplement parcequ'il y'a un test dans le fichier error.phtml

    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
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"; "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head>  
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
      <title>Zend Framework Default Application</title> 
    </head> 
    <body> 
      <h1>An error occurred</h1> 
      <h2><?= $this->message ?></h2> 
    
      <? if ('development' == APPLICATION_ENV): ?> 
      
      <h3>Exception information:</h3> 
      <p> 
          <b>Message:</b> <?= $this->exception->getMessage() ?> 
      </p> 
    
      <h3>Stack trace:</h3> 
      <pre><?= $this->exception->getTraceAsString() ?> 
      </pre> 
    
      <h3>Request Parameters:</h3> 
      <pre><? var_dump($this->request->getParams()) ?> 
      </pre> 
      <? endif ?>
      
    </body> 
    </html>

  8. #8
    Modérateur

    Avatar de MaitrePylos
    Homme Profil pro
    DBA
    Inscrit en
    Juin 2005
    Messages
    5 496
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 496
    Points : 12 596
    Points
    12 596
    Par défaut
    Je savais que j'étais dans le bon, mais j'ai pas pensé à la vue

  9. #9
    Membre à l'essai
    Homme Profil pro
    Lycéen
    Inscrit en
    Octobre 2011
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2011
    Messages : 11
    Points : 18
    Points
    18
    Par défaut
    verifier le bon emplacement des fichiers, il est très probable que le pb reside au niveau de l'arboressance;
    après verification redemarres ton serveur

  10. #10
    Membre éprouvé
    Avatar de 5h4rk
    Homme Profil pro
    CTO at TabMo
    Inscrit en
    Février 2011
    Messages
    813
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : CTO at TabMo
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Février 2011
    Messages : 813
    Points : 1 297
    Points
    1 297
    Par défaut
    Bonsoir,
    Une question pourquoi index1.php alors que tout de base est redirigé vers index.php ?
    Et qu'en suite le routage est fait par celui ci ?
    Car mettre index1.php ne peut pas être possible, cela voudrait dire que tu as un controlleur du nom index1.php donc :
    application/
    controllers/Index1.phpController.php (tu vois bien qu'il y a un problème ?)

  11. #11
    Membre à l'essai
    Homme Profil pro
    Lycéen
    Inscrit en
    Octobre 2011
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Lycéen
    Secteur : Enseignement

    Informations forums :
    Inscription : Octobre 2011
    Messages : 11
    Points : 18
    Points
    18

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Détection des erreurs dans un fichier texte (txt)
    Par M E H D I dans le forum VB 6 et antérieur
    Réponses: 9
    Dernier message: 25/05/2010, 10h14
  2. Réponses: 3
    Dernier message: 04/12/2009, 01h42
  3. [Configuration] Paramétrage des erreurs dans php.ini
    Par Velkan.nexus dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 3
    Dernier message: 21/10/2007, 12h42
  4. Configurer des paramétres dans le fichier server.xml
    Par root76 dans le forum Tomcat et TomEE
    Réponses: 1
    Dernier message: 13/02/2007, 17h16
  5. [C#] Comment serializer l'écriture des erreurs dans un fichier
    Par LE NEINDRE dans le forum Windows Forms
    Réponses: 9
    Dernier message: 17/11/2006, 14h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo