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

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Avatar de Jcpan
    Inscrit en
    Août 2008
    Messages
    542
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 542
    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 506
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 506
    Par défaut
    Bonjour,

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

  3. #3
    Membre éclairé
    Avatar de Jcpan
    Inscrit en
    Août 2008
    Messages
    542
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 542
    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 506
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 506
    Par défaut
    et le errorController donne quoi ?

  5. #5
    Membre éclairé
    Avatar de Jcpan
    Inscrit en
    Août 2008
    Messages
    542
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 542
    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 506
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

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

  7. #7
    Membre habitué
    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

+ 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