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

Zend Framework PHP Discussion :

error 404, problème d'URL


Sujet :

Zend Framework PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 6
    Par défaut error 404, problème d'URL
    bonjour,

    avez vous une idée de solution s'il vous plait?
    j'ai une erreur lorsque je me connecte au serveur wamp (j'utilise Zend):
    Warning: require_once(../Loader.php): failed to open stream: No such file or directory in C:\wamp\www\MediateamB\mediateam_bronze\library\Zend\Controller\Front.php on line 23

    Fatal error: require_once(): Failed opening required '../Loader.php' (include_path='.;./library/;./models/;./library/Smarty/libs/;./library/Zend/;./conf/;.;C:\php5\pear') in C:\wamp\www\MediateamB\mediateam_bronze\library\Zend\Controller\Front.php on line 23
    Les fichiers Front.php et Loader.php existent bel et bien a cet endroit. Voici le contenu de mes fichiers:

    Front.php:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    /** Zend_Loader */
     
    ligne23: require_once '../Loader.php';
     
    /** Zend_Controller_Action_HelperBroker */
    require_once '/Action/HelperBroker.php';
     
    /** Zend_Controller_Action_Helper_ViewRenderer */
    require_once '/Action/Helper/ViewRenderer.php';
     
    /** Zend_Controller_Exception */
    Loader.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
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    class Zend_Loader
    {
        /**
         * Loads a class from a PHP file.  The filename must be formatted
         * as "$class.php".
         *
         * If $dirs is a string or an array, it will search the directories
         * in the order supplied, and attempt to load the first matching file.
         *
         * If $dirs is null, it will split the class name at underscores to
         * generate a path hierarchy (e.g., "Zend_Example_Class" will map
         * to "Zend/Example/Class.php").
         *
         * If the file was not found in the $dirs, or if no $dirs were specified,
         * it will attempt to load it from PHP's include_path.
         *
         * @param string $class      - The full class name of a Zend component.
         * @param string|array $dirs - OPTIONAL Either a path or an array of paths
         *                             to search.
         * @return void
         * @throws Zend_Exception
         */
        public static function loadClass($class, $dirs = null)
        {
            if (class_exists($class, false) || interface_exists($class, false)) {
                return;
            }
     
            if ((null !== $dirs) && !is_string($dirs) && !is_array($dirs)) {
                require_once 'Exception.php';
                throw new Zend_Exception('Directory argument must be a string or an array');
            }
            if (null === $dirs) {
                $dirs = array();
            }
            if (is_string($dirs)) {
                $dirs = (array) $dirs;
            }
     
            // autodiscover the path from the class name
            $path = str_replace('_', DIRECTORY_SEPARATOR, $class);
            if ($path != $class) {
                // use the autodiscovered path
                $dirPath = dirname($path);
                if (0 == count($dirs)) {
                    $dirs = array($dirPath);
                } else {
                    foreach ($dirs as $key => $dir) {
                        if ($dir == '.') {
                            $dirs[$key] = $dirPath;
                        } else {
                            $dir = rtrim($dir, '\\/');
                            $dirs[$key] = $dir . DIRECTORY_SEPARATOR . $dirPath;
                        }
                    }
                }
                $file = basename($path) . '.php';
            } else {
                $file = $class . '.php';
            }
     
            self::loadFile($file, $dirs, true);
     
            if (!class_exists($class, false) && !interface_exists($class, false)) {
                require_once 'Exception.php';
                throw new Zend_Exception("File \"$file\" was loaded but class \"$class\" was not found in the file");
            }
        }
     
        /**
         * Loads a PHP file.  This is a wrapper for PHP's include() function.
         *
         * $filename must be the complete filename, including any
         * extension such as ".php".  Note that a security check is performed that
         * does not permit extended characters in the filename.  This method is
         * intended for loading Zend Framework files.
         *
         * If $dirs is a string or an array, it will search the directories
         * in the order supplied, and attempt to load the first matching file.
         *
         * If the file was not found in the $dirs, or if no $dirs were specified,
         * it will attempt to load it from PHP's include_path.
         *
         * If $once is TRUE, it will use include_once() instead of include().
         *
         * @param  string        $filename
         * @param  string|array  $dirs - OPTIONAL either a path or array of paths
         *                       to search.
         * @param  boolean       $once
         * @return boolean
         * @throws Zend_Exception
         */
        public static function loadFile($filename, $dirs = null, $once = false)
        {
            /**
             * Security check
             */
            if (preg_match('/[^a-z0-9\-_.]/i', $filename)) {
                require_once 'Exception.php';
                throw new Zend_Exception('Security check: Illegal character in filename');
            }
     
            /**
             * Search for the file in each of the dirs named in $dirs.
             */
            if (is_null($dirs)) {
                $dirs = array();
            } elseif (is_string($dirs))  {
                $dirs = explode(PATH_SEPARATOR, $dirs);
            }
            foreach ($dirs as $dir) {
                $filespec = rtrim($dir, '\\/') . DIRECTORY_SEPARATOR . $filename;
                if (self::isReadable($filespec)) {
                    return self::_includeFile($filespec, $once);
                }
            }
     
            /**
             * The file was not found in the $dirs specified.
             * Try finding for the plain filename in the include_path.
             */
            if (self::isReadable($filename)) {
                return self::_includeFile($filename, $once);
            }
     
            /**
             * The file was not located anywhere.
             */
            require_once 'Exception.php';
            throw new Zend_Exception("File \"$filename\" was not found");
        }
     
        /**
         * Attempt to include() the file.
         *
         * include() is not prefixed with the @ operator because if
         * the file is loaded and contains a parse error, execution
         * will halt silently and this is difficult to debug.
         *
         * Always set display_errors = Off on production servers!
         *
         * @param  string  $filespec
         * @param  boolean $once
         * @return boolean
         */
        protected static function _includeFile($filespec, $once = false)
        {
            if ($once) {
                return include_once $filespec;
            } else {
                return include $filespec ;
            }
        }
     
        /**
         * Returns TRUE if the $filename is readable, or FALSE otherwise.
         * This function uses the PHP include_path, where PHP's is_readable()
         * does not.
         *
         * @param string   $filename
         * @return boolean
         */
        public static function isReadable($filename)
        {
            if (@is_readable($filename)) {
                return true;
            }
     
            $path = get_include_path();
            $dirs = explode(PATH_SEPARATOR, $path);
     
            foreach ($dirs as $dir) {
                // No need to check against current dir -- already checked
                if ('.' == $dir) {
                    continue;
                }
     
                if (@is_readable($dir . DIRECTORY_SEPARATOR . $filename)) {
                    return true;
                }
            }
     
            return false;
        }
     
        /**
         * spl_autoload() suitable implementation for supporting class autoloading.
         *
         * Attach to spl_autoload() using the following:
         * <code>
         * spl_autoload_register(array('Zend_Loader', 'autoload'));
         * </code>
         *
         * @param string $class
         * @return string|false Class name on success; false on failure
         */
        public static function autoload($class)
        {
            try {
                self::loadClass($class);
                return $class;
            } catch (Exception $e) {
                return false;
            }
        }
     
        /**
         * Register {@link autoload()} with spl_autoload()
         *
         * @param string OPTIONAL $class
         * @param boolean OPTIONAL $enabled
         * @return void
         * @throws Zend_Exception if spl_autoload() is not found
         * or if the specified class does not have an autoload() method.
         */
        public static function registerAutoload($class = 'Zend_Loader', $enabled = true)
        {
            if (!function_exists('spl_autoload_register')) {
                require_once 'Exception.php';
                throw new Zend_Exception('spl_autoload does not exist in this PHP installation');
            }
     
            self::loadClass($class);
            $methods = get_class_methods($class);
            if (!in_array('autoload', (array) $methods)) {
                require_once 'Exception.php';
                throw new Zend_Exception("The class \"$class\" does not have an autoload() method");
            }
     
            if ($enabled === true) {
                spl_autoload_register(array($class, 'autoload'));
            } else {
                spl_autoload_unregister(array($class, 'autoload'));
            }
        }
    }

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2008
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2008
    Messages : 50
    Par défaut
    Tu as un problème de lien. Le fichier Loader.php ne se trouve pas au bon endroit. Vérifie bien que le fichier Loader.php est bien un répertoire au-dessus de ta page (../)

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 6
    Par défaut
    le fichier Loader.php est bien au repertoire parent de front.php.
    D'ailleurs, si je change le chemin, le systeme me met un warning au niveau de la ligne 23.

    La il n'y a pas de Warning, mais par contre, il y a une fleche au niveau de la ligne 23 (j'utilise Eclipse) , je crois que c'est un break point.

    J ene sais pas si ca peut vous aider mais:
    - mon workspace est local et sa reference sur une autre machine, je travaille en reseau
    -de plus souvent je dois recreer mon workspace parce qu'il ne trouve pas les fichiers. Mais ici il trouve tout sauf un fichier.
    -Je ne connais pas la difference entre require_once et include, pensez vous que ce soit lier a ca?

    En fait, tout fonctionnait sans cette erreur, mais depuis que j'ai corriger des Warning et creer un nouveau Workspace, il me fait cette erreur.

    Avez vous une idée?? merci

  4. #4
    Membre Expert
    Avatar de Eusebe
    Inscrit en
    Mars 2006
    Messages
    1 992
    Détails du profil
    Informations personnelles :
    Âge : 47

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 992
    Par défaut
    Bonjour,

    Le code du ZF ne génère pas d'erreur ni de warning. Si tu en as, ils doivent venir de ta configuration ou de ton code. Evites de modifier directement les sources du framework, ça ne t'apportera que des ennuis...

    Tu as marqué "depuis que j'ai corriger des Warning (...) il me fait cette erreur.". Je ne plus quelle erreur tu as, ni quand... Si tu utilises le code d'origine du framework, quelle est l'erreur ?

  5. #5
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    6
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 6
    Par défaut
    merci pour votre aide, j'avais garder une sauvegarde du projet, j'ai donc remplacer le dossier librairie ou il y avait Zend, et la ca fonctionne.

    Par contre, savez vous où je pourrais recuperer le contenu du fichier registry.php de Zend Framework ? car j'ai recuperer un projet de quelqu'un et il y avait deja une erreur dans ce fichier, et je n'aime pas modifier les fichiers Zend a la main

    Merci!!

    or voici l'erreur:
    Parser error "')' expected in function call (self)." MediateamBR/library/Zend Registry.php line 54 1210682666218 5808

    Registry.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
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
     
    <?php
    /**
     * Zend Framework
     *
     * LICENSE
     *
     * This source file is subject to the new BSD license that is bundled
     * with this package in the file LICENSE.txt.
     * It is also available through the world-wide-web at this URL:
     * http://framework.zend.com/license/new-bsd
     * If you did not receive a copy of the license and are unable to
     * obtain it through the world-wide-web, please send an email
     * to license@zend.com so we can send you a copy immediately.
     *
     * @category   Zend
     * @package    Zend_Registry
     * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
     * @license    http://framework.zend.com/license/new-bsd     New BSD License
     * @version    $Id: Registry.php 5491 2007-06-29 00:41:56Z bkarwin $
     */
     
    /**
     * Generic storage class helps to manage global data.
     *
     * @category   Zend
     * @package    Zend_Registry
     * @copyright  Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
     * @license    http://framework.zend.com/license/new-bsd     New BSD License
     */
    class Zend_Registry extends ArrayObject
    {
        /**
         * Class name of the singleton registry object.
         * @var string
         */
        private static $_registryClassName = 'Zend_Registry';
     
        /**
         * Registry object provides storage for shared objects.
         * @var Zend_Registry
         */
        private static $_registry = null;
     
        /**
         * Retrieves the default registry instance.
         *
         * @return Zend_Registry
         */
        public static function getInstance()
        {
            if (self::$_registry === null) {
                self::init();
            }
     
            return self::$_registry;
        }
     
        /**
         * Set the default registry instance to a specified instance.
         *
         * @param Zend_Registry $registry An object instance of type Zend_Registry,
         *   or a subclass.
         * @return void
         * @throws Zend_Exception if registry is already initialized.
         */
        public static function setInstance(Zend_Registry $registry)
        {
            if (self::$_registry !== null) {
                require_once 'Zend/Exception.php';
                throw new Zend_Exception('Registry is already initialized');
            }
     
            self::setClassName(get_class($registry));
            self::$_registry = $registry;
        }
     
        /**
         * Initialize the default registry instance.
         *
         * @return void
         */
        protected static function init()
        {
            self::setInstance(new self::$registryClassName());
        }
     
        /**
         * Set the class name to use for the default registry instance.
         * Does not affect the currently initialized instance, it only applies
         * for the next time you instantiate.
         *
         * @param string $registryClassName
         * @return void
         * @throws Zend_Exception if the registry is initialized or if the
         *   class name is not valid.
         */
        public static function setClassName($registryClassName = 'Zend_Registry')
        {
            if (self::$_registry !== null) {
                require_once 'Zend/Exception.php';
                throw new Zend_Exception('Registry is already initialized');
            }
     
            if (!is_string($registryClassName)) {
                require_once 'Zend/Exception.php';
                throw new Zend_Exception("Argument is not a class name");
            }
     
            /**
             * @see Zend_Loader
             */
            require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($registryClassName);
     
            self::$_registryClassName = $registryClassName;
        }
     
        /**
         * Unset the default registry instance.
         * Primarily used in tearDown() in unit tests.
         * @returns void
         */
        public static function _unsetInstance()
        {
            self::$_registry = null;
        }
     
        /**
         * getter method, basically same as offsetGet().
         *
         * This method can be called from an object of type Zend_Registry, or it
         * can be called statically.  In the latter case, it uses the default
         * static instance stored in the class.
         *
         * @param string $index - get the value associated with $index
         * @return mixed
         * @throws Zend_Exception if no entry is registerd for $index.
         */
        public static function get($index)
        {
            $instance = self::getInstance();
     
            if (!$instance->offsetExists($index)) {
                require_once 'Zend/Exception.php';
                throw new Zend_Exception("No entry is registered for key '$index'");
            }
     
            return $instance->offsetGet($index);
        }
     
        /**
         * setter method, basically same as offsetSet().
         *
         * This method can be called from an object of type Zend_Registry, or it
         * can be called statically.  In the latter case, it uses the default
         * static instance stored in the class.
         *
         * @param string $index The location in the ArrayObject in which to store
         *   the value.
         * @param mixed $value The object to store in the ArrayObject.
         * @return void
         */
        public static function set($index, $value)
        {
            $instance = self::getInstance();
            $instance->offsetSet($index, $value);
        }
     
        /**
         * Returns TRUE if the $index is a named value in the registry,
         * or FALSE if $index was not found in the registry.
         *
         * @param  string $index
         * @return boolean
         */
        public static function isRegistered($index)
        {
            if (self::$_registry === null) {
                return false;
            }
            return self::$_registry->offsetExists($index);
        }
     
        /**
         * @param string $index
         * @returns mixed
         *
         * Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960).
         */
        public function offsetExists($index)
        {
            return array_key_exists($index, $this);
        }
     
    }

  6. #6
    Membre Expert
    Avatar de Eusebe
    Inscrit en
    Mars 2006
    Messages
    1 992
    Détails du profil
    Informations personnelles :
    Âge : 47

    Informations forums :
    Inscription : Mars 2006
    Messages : 1 992
    Par défaut
    Il est disponible là :
    http://framework.zend.com/download

    Mais il faut que tu récupères la même version que celle utilisée pour créer le projet...

    Et tu peux aussi avoir des erreurs php qui t'envoient vers un fichier du framework alors que l'erreur vient du code de ton application...

Discussions similaires

  1. Yum <commande> : "The requested URL returned error: 404 Not Found"
    Par Marc_27 dans le forum RedHat / CentOS / Fedora
    Réponses: 1
    Dernier message: 20/06/2014, 10h28
  2. Problème "Error 404: SRVE0190E: File not found"
    Par ibousan dans le forum Websphere
    Réponses: 1
    Dernier message: 02/01/2012, 14h00
  3. [htaccess] Problème d'url rewriting
    Par scorpiwolf dans le forum Apache
    Réponses: 4
    Dernier message: 02/12/2005, 18h21
  4. Problème d'URL
    Par polux23 dans le forum Apache
    Réponses: 3
    Dernier message: 29/09/2005, 12h06
  5. Error 404 [CGI]
    Par nah_wah dans le forum Web
    Réponses: 11
    Dernier message: 16/09/2005, 18h40

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