[Symfony] / final plante l'URL

Eléphant du PHP | 50 Messages

04 oct. 2010, 23:44

Bonjour à tous,

Je découvre Symfony depuis peu et me heurte à un problème durant le tutoriel Jobeet !
En fait, tout marche parfait sauf que lorsque je vais à l'URL :

http://www.myproj.localhost/ProjSF2_dev.php/ProjSF2/

au lieu de

http://www.myproj.localhost/ProjSF2_dev.php/ProjSF2

J'obtiens l'erreur suivante :

Code : Tout sélectionner

404 | Not Found | sfError404Exception Empty module and/or action after parsing the URL "/ProjSF2/" (/). stack trace * at () in SF_SYMFONY_LIB_DIR/controller/sfFrontWebController.class.php line 44 ... 41. 42. if (empty($moduleName) || empty($actionName)) 43. { 44. throw new sfError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $request->getPathInfo(), $moduleName, $actionName)); 45. } 46. 47. // make the first request * at sfFrontWebController->dispatch() in SF_SYMFONY_LIB_DIR/util/sfContext.class.php line 170 ... 167. */ 168. public function dispatch() 169. { 170. $this->getController()->dispatch(); 171. } 172. 173. /** * at sfContext->dispatch() in SF_ROOT_DIR/web/ProjSF2_dev.php line 13 ... 10. require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 11. 12. $configuration = ProjectConfiguration::getApplicationConfiguration('ProjSF2', 'dev', true); 13. sfContext::createInstance($configuration)->dispatch(); 14. symfony settings ... sf_admin_module_web_dir: /sfDoctrinePlugin sf_admin_web_dir: /sf/sf_admin sf_app: ProjSF2 sf_app_base_cache_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/cache/ProjSF2 sf_app_cache_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/cache/ProjSF2/dev sf_app_config_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/apps/ProjSF2/config sf_app_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/apps/ProjSF2 sf_app_i18n_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/apps/ProjSF2/i18n sf_app_lib_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/apps/ProjSF2/lib sf_app_module_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/apps/ProjSF2/modules sf_app_template_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/apps/ProjSF2/templates sf_apps_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/apps sf_cache: false sf_cache_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/cache sf_charset: utf-8 sf_check_lock: false sf_compressed: false sf_config_cache_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/cache/ProjSF2/dev/config sf_config_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/config sf_csrf_secret: 3c350ffb2f9cb6e562dcb4bd111a25302dde4fd4 sf_data_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/data sf_debug: true sf_default_culture: en sf_enabled_modules: - default sf_environment: dev sf_error_404_action: error404 sf_error_404_module: default sf_error_reporting: 32767 sf_escaping_method: ESC_SPECIALCHARS sf_escaping_strategy: true sf_etag: false sf_file_link_format: null sf_i18n: false sf_i18n_cache_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/cache/ProjSF2/dev/i18n sf_lib_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/lib sf_log_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/log sf_logging_enabled: true sf_login_action: login sf_login_module: default sf_module_cache_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/cache/ProjSF2/dev/modules sf_module_disabled_action: disabled sf_module_disabled_module: default sf_no_script_name: false sf_orm: doctrine sf_plugins_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/plugins sf_root_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2 sf_secure_action: secure sf_secure_module: default sf_standard_helpers: - Partial - Cache sf_symfony_lib_dir: /Applications/XAMPP/xamppfiles/htdocs/symfony/lib/vendor/symfony/lib sf_template_cache_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/cache/ProjSF2/dev/template sf_test_cache_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/cache/ProjSF2/dev/test sf_test_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/test sf_upload_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/web/uploads sf_use_database: true sf_web_debug: true sf_web_debug_web_dir: /sf/sf_web_debug sf_web_dir: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/web request ... options: path_info_key: PATH_INFO path_info_array: SERVER http_port: null https_port: null default_format: null logging: '1' relative_url_root: null formats: { txt: text/plain, js: [application/javascript, application/x-javascript, text/javascript], css: text/css, json: [application/json, application/x-json], xml: [text/xml, application/xml, application/x-xml], rdf: application/rdf+xml, atom: application/atom+xml } no_script_name: false parameterHolder: { } attributeHolder: { } response ... status: code: 404 text: 'Not Found' options: http_protocol: HTTP/1.1 logging: '1' charset: utf-8 send_http_headers: true content_type: 'text/html; charset=utf-8' cookies: { } httpHeaders: Content-Type: 'text/html; charset=utf-8' javascripts: { } stylesheets: { } metas: { } httpMetas: { } user ... options: auto_shutdown: false culture: null default_culture: en use_flash: true logging: '1' timeout: 1800 attributeHolder: { } culture: en global vars ... cookie: symfony: ffc2bc92972f033e2711ae8a28dd03d6 env: Apple_PubSub_Socket_Render: /tmp/launch-p6nSW6/Render COMMAND_MODE: legacy DISPLAY: '/tmp/launch-smyNEJ/org.x:0' HOME: /Users/jeremiecampari LOGNAME: jeremiecampari PATH: '/usr/bin:/bin:/usr/sbin:/sbin' PWD: / SHELL: /bin/bash SHLVL: '1' SSH_AUTH_SOCK: /tmp/launch-kNXv57/Listeners TMPDIR: /Applications/XAMPP/xamppfiles/temp/ USER: jeremiecampari _: /Applications/XAMPP/xamppfiles/bin/httpd _BASH_IMPLICIT_DASH_PEE: -p __AUTHORIZATION: 'auth 14' __CF_USER_TEXT_ENCODING: '0x0:0:1' files: { } get: { } post: { } server: DOCUMENT_ROOT: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/web GATEWAY_INTERFACE: CGI/1.1 HTTP_ACCEPT: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' HTTP_ACCEPT_CHARSET: 'ISO-8859-1,utf-8;q=0.7,*;q=0.7' HTTP_ACCEPT_ENCODING: 'gzip,deflate' HTTP_ACCEPT_LANGUAGE: 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' HTTP_CONNECTION: keep-alive HTTP_COOKIE: symfony=ffc2bc92972f033e2711ae8a28dd03d6 HTTP_HOST: www.monsite.localhost HTTP_KEEP_ALIVE: '115' HTTP_USER_AGENT: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10' PATH: '/usr/bin:/bin:/usr/sbin:/sbin' PATH_INFO: /ProjSF2/ PATH_TRANSLATED: 'redirect:/index.php/' PHP_SELF: /ProjSF2_dev.php/ProjSF2/ QUERY_STRING: '' REMOTE_ADDR: 127.0.0.1 REMOTE_PORT: '54208' REQUEST_METHOD: GET REQUEST_TIME: 1286228490 REQUEST_URI: /ProjSF2_dev.php/ProjSF2/ SCRIPT_FILENAME: /Applications/XAMPP/xamppfiles/htdocs/ProjSF2/web/ProjSF2_dev.php SCRIPT_NAME: /ProjSF2_dev.php SERVER_ADDR: 127.0.0.1 SERVER_ADMIN: [email protected] SERVER_NAME: www.monsite.localhost SERVER_PORT: '80' SERVER_PROTOCOL: HTTP/1.1 SERVER_SIGNATURE: '' SERVER_SOFTWARE: 'Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1' UNIQUE_ID: TKpKCsCoAX4AAIYuatIAAAAC argc: 0 argv: { } session: symfony/user/sfUser/attributes: { } symfony/user/sfUser/authenticated: false symfony/user/sfUser/credentials: { } symfony/user/sfUser/culture: en symfony/user/sfUser/lastRequest: 1286228344 symfony v.1.4.8 - php 5.3.1 for help resolving this issue, please visit http://www.symfony-project.org/.
Comment puis-je résoudre ce problème ? :shock: :shock:

Merci d'avance pour votre aide,
JC.
Modifié en dernier par Jeremieca le 28 oct. 2010, 00:05, modifié 3 fois.
Devoir de mémoire : http://voyage-etude-auschwitz.net
Projet de classe réalisé suite à un voyage au camp d'Auschwitz.

Avatar du membre
Administrateur PHPfrance
Administrateur PHPfrance | 13231 Messages

05 oct. 2010, 23:02

Si tu lis le message d'erreur, il te dit la chose suivante :
Empty module and/or action after parsing the URL "/ProjSF2/" (/).
Ce qu'il faut comprendre ici, c'est qu'il a utilisé la route '/' pour l'url '/ProjSF2/'

Il y a donc un soucis dans le système de réécriture, et il ne comprend pas que ProjSF2_dev.php est ton contrôleur.
Est-ce que tu peux vider tes fichiers de log (supprimer le contenu du dossier log/ de ton projet, retenter d'accéder à l'url problématique (juste celle là) et nous dire quels sont les fichiers créés, ainsi que leur contenu ?
Connaître son ignorance est la meilleure part de la connaissance
Pour un code lisible : n'hésitez pas à sauter des lignes et indenter

twitter - site perso - Github - Zend Certified Engineer

Eléphant du PHP | 50 Messages

05 oct. 2010, 23:44

Salut,

Merci pour ton aide précieuse ! j'ai un seul fichier créer nommé ProjSF2_dev.log qui contient :

Code : Tout sélectionner

Oct 05 21:42:04 symfony [info] {myUser} Automatic user logout due to timeout Oct 05 21:42:04 symfony [info] {myUser} User is not authenticated Oct 05 21:42:04 symfony [err] {sfError404Exception} Empty module and/or action after parsing the URL "/ProjSF2/" (/). Oct 05 21:42:04 symfony [info] {sfWebResponse} Send status "HTTP/1.1 404 Not Found" Oct 05 21:42:04 symfony [info] {sfWebResponse} Send header "Content-Type: text/html; charset=utf-8" Oct 05 21:42:04 symfony [info] {sfWebDebugLogger} Configuration 67.80 ms (5) Oct 05 21:42:04 symfony [info] {sfWebDebugLogger} Factories 133.10 ms (1)
Merci d'avance pour ton aide,
A plus !
JC.
Devoir de mémoire : http://voyage-etude-auschwitz.net
Projet de classe réalisé suite à un voyage au camp d'Auschwitz.

Eléphant du PHP | 50 Messages

05 oct. 2010, 23:52

Re,

J'ai corrigé l'énoncé, j'ai édité les URLs posant le problèmes, j'avais mis "job" au lieu de ProjSF2 à la fin des URLs.
Je ne pense pas que ça est une grande importance mais je tenais à le modifier. Désolé pour l'erreur.

JC.
Devoir de mémoire : http://voyage-etude-auschwitz.net
Projet de classe réalisé suite à un voyage au camp d'Auschwitz.

Avatar du membre
Administrateur PHPfrance
Administrateur PHPfrance | 13231 Messages

06 oct. 2010, 11:10

Ok, donne moi ton fichier de routing.
Je pensais, à tord, qu'il bloquait sur le nom de ton contrôleur, pas sur l'url.
Connaître son ignorance est la meilleure part de la connaissance
Pour un code lisible : n'hésitez pas à sauter des lignes et indenter

twitter - site perso - Github - Zend Certified Engineer

Eléphant du PHP | 50 Messages

06 oct. 2010, 11:25

Voici mon fichier routing.yml :

Code : Tout sélectionner

# You can find more information about this file on the symfony website: # http://www.symfony-project.org/reference/1_4/en/10-Routing job_show_user: url: /ProjSF2/:company_slug/:location_slug/:id/:position_slug class: sfDoctrineRoute options: { model: JobeetJob, type: object } param: { module: ProjSF2, action: show } requirements: id: \d+ sf_mehod: [get] job_edit_user: url: /ProjSF2/edit/:company_slug/:location_slug/:id/:position_slug class: sfDoctrineRoute options: { model: JobeetJob, type: object } param: { module: ProjSF2, action: edit } requirements: id: \d+ sf_mehod: [get] job_new_user: url: /new param: { module: ProjSF2, action: new } # default rules homepage: url: / param: { module: ProjSF2, action: index } # generic rules # please, remove them by adding more specific rules default_index: url: /:module param: { action: index } default: url: /:module/:action/*
A plus et merci !
JC.
Devoir de mémoire : http://voyage-etude-auschwitz.net
Projet de classe réalisé suite à un voyage au camp d'Auschwitz.

Eléphant du PHP | 50 Messages

28 oct. 2010, 00:06

Up

Une peu d'aide s'il vous plait !

Merci d'avance,
JC.
Devoir de mémoire : http://voyage-etude-auschwitz.net
Projet de classe réalisé suite à un voyage au camp d'Auschwitz.

Eléphanteau du PHP | 15 Messages

24 nov. 2010, 19:39

Hello,

C'est tout a fait normale si tu veux avoir ce comportement ( qui ne l'est pas par défaut) il faut que tu rajoutes une route générique mais bon ( saymal). Rajoute ça tout en bas de ton routing.yml ça devrait le faire :)

Code : Tout sélectionner

default_slash: url: /:module/ param: { action: index }

Bonne soirée. Shine-neko