Précédent   Forum des professionnels en informatique > PHP > Outils > Zend > Zend Framework
Zend Framework Forum d'entraide sur la programmation PHP avec Zend Framework. Avant de poster -> FAQ ZF, Cours ZF
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 31/03/2008, 23h41   #1
Membre du Club
 
Homme Jonathan
Inscription : avril 2007
Messages : 274
Détails du profil
Informations personnelles :
Nom : Homme Jonathan

Informations forums :
Inscription : avril 2007
Messages : 274
Points : 57
Points : 57
Par défaut Démarrage difficile: 500 Internal Server Error

Bonjour à tous,

Je débute dans l'utilisation de framework et j'ai décidé d'utiliser le ZF. Je rencontre déjà quelques soucis

J'ai suivi le tutoriel de developpez.com "Débuter avec le Zend Framework (approche MVC)"
Je suis arrivé à la fin de l'étape II-B-2. J'ai également suivi d'autre tutoriel j'ai donc créer les fichiers suivant :
=>/var/www/projet/site1/application/controllers/IndexController.php
Code :
1
2
3
4
5
6
7
8
9
10
11
<?php
/** Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';
 
class IndexController extends Zend_Controller_Action
{
    public function indexAction()
    {
        $this->render();
    }
}
et
=>/var/www/projet/site1/application/views/scripts/index/index.phtml
Code :
1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>My first Zend Framework App</title>
</head>
<body>
    <h1>Hello, World!</h1>
</body>
</html>
Et finalement, au moment d'accéder à la racine de l'application, j'ai l'erreur suivante:
Code :
500 Internal Server Error
J'ai remarqué également que si j'accède au répertoire parent "/var/www/projet/" depuis mon navigateur web, je ne vois pas le répertoire "site1"

Pour finir j'ai le fichier /var/www/projet/site1/.htaccess
Code :
1
2
3
4
5
RewriteEngine on
RewriteRule .* index.php
 
php_flag magic_quotes_gpc off
php_flag register_globals off
Si je retire ce fichier j'accède bien à ma page d'index avec la phrase "Hello, World!".

"Malheureusement", ce fichier est utile pour le fonctionnement de ZF (d'après ce que j'ai compris).

Je ne comprend pas le pourquoi du comment?

[EDIT]
Si je regarde les logs apache, voici ce que je trouve:
Code :
[Mon Mar 31 19:12:20 2008] [alert] [client 192.168.2.21] /var/www/projet/site1/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[EDIT2]
J'ai activé l'url rewriting par cette commande
et je recontre maintenant l'erreur suivante :

Est-ce que cela veut dire que la configuration d'apache n'est pas correcte pour utiliser l'url rewriting?


Je vous remercie d'avance.
Jonathan.b est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/04/2008, 10h22   #2
Membre habitué
 
Avatar de Ashgenesis
 
Développeur Web
Inscription : mai 2004
Messages : 183
Détails du profil
Informations personnelles :
Âge : 30
Localisation : France, Paris (Île de France)

Informations professionnelles :
Activité : Développeur Web

Informations forums :
Inscription : mai 2004
Messages : 183
Points : 138
Points : 138
Je pense que c'est plutôt une erreur de vhost

Montre nous ton vhost pour être sur.

Sinon sans parler de Zend Framework arrive tu déjà à accéder normalement au fichier index.php.

Va revoir aussi les règles de rewrite http://framework.zend.com/manual/en/...art.go.rewrite
Ashgenesis est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/04/2008, 12h50   #3
Membre du Club
 
Homme Jonathan
Inscription : avril 2007
Messages : 274
Détails du profil
Informations personnelles :
Nom : Homme Jonathan

Informations forums :
Inscription : avril 2007
Messages : 274
Points : 57
Points : 57
Si je met un fichier index.php tout simple dans le répertoire site1 sans .htaccess à coté, j'arrive bien à accéder à la page web.

Je suis sous apache2 et j'ai donc configuré mes vhosts dans le fichier
/etc/apache2/httpd.conf
Code :
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
NameVirtualHost *
<VirtualHost *>
	ServerAdmin webmaster@localhost
 
	DocumentRoot /var/www/
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
		# This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # RedirectMatch ^/$ /apache2-default/
	</Directory>
 
	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>
 
	ErrorLog /var/log/apache2/error.log
 
	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
 
	CustomLog /var/log/apache2/access.log combined
	ServerSignature On
 
    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
 
	Alias /mysql "/var/www/phpmyadmin/"
	<Directory "/var/www/PhpMyAdmin/">
		Options Indexes MultiViews
		AllowOverride None
		Order allow,deny
		Allow from all
	</Directory> 
 
	Alias /0rigine "/var/www/projet/site1/"
	<Directory "/var/www/projet/site1/">
 
		Options Indexes MultiViews
		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory> 
 
</VirtualHost>
J'ai également remarqué un message d'erreur lorsque je redémarre apache:
Code :
/etc/init.d/apache2 restart
Code :
1
2
Forcing reload of web server (apache2)...apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Jonathan.b est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/04/2008, 23h27   #4
Membre du Club
 
Homme Jonathan
Inscription : avril 2007
Messages : 274
Détails du profil
Informations personnelles :
Nom : Homme Jonathan

Informations forums :
Inscription : avril 2007
Messages : 274
Points : 57
Points : 57
J'ai modifier le fichier httpd.conf en rajoutant la ligne ServerName 127.0.0.1 au début du fichier.
Je n'ai plus le message d'erreur au redémarrage d'apache mais je n'arrive toujours pas à accéder à la page index.php de l'application.

J'ai ensuite regardé le fichier
/var/log/apache2/error.log
et je vois le message suivant:

Code :
[error] [client 192.168.2.21] Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/projet/site1/
Jonathan.b est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/04/2008, 00h53   #5
Membre du Club
 
Homme Jonathan
Inscription : avril 2007
Messages : 274
Détails du profil
Informations personnelles :
Nom : Homme Jonathan

Informations forums :
Inscription : avril 2007
Messages : 274
Points : 57
Points : 57
Problème résolu. Il manquait l'option FollowSymLinks dans la conf apache.

<Directory "/var/www/projet/site1/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Merci encore pour votre aide.
Jonathan.b est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 19h01.


 
 
 
 
Partenaires

Hébergement Web