Configuration Apache
RésoluVoila alors je me lance dans linux :) je développe des application web et je souhaite installé en local chez moi un poste linux avec apache/php/mysql pour me faire un serveur de teste.
J'ai instalé kubuntu et configuré ma connection le tout impecable :)
je suis super satisfait de l'OS.
J'ai installé apache et tout ce qu'il me faut et j'ai mis un fichier index.php avec juste un echo"index";
dans /var/www.
maintenant mon problème (ben oui il en faut un :)) lorsque je tape http://MonIp dans firefox il me propose de telechargé mon fichier index.php au lieu de l'affiché ...
Quelqu'un aurait il une idée ? :)
Merci pour votre aide!
Configuration: Linux Firefox 2.0.0.12
41 réponses
Problème central : l'accès à http://IP renvoie le téléchargement du fichier index.php au lieu de l'exécuter via Apache et PHP sur un poste Linux local correctement. Des réponses indiquent qu'il faut activer le module PHP dans Apache et vérifier que PHP est bien chargé, par exemple via les liens php5.load et php5.conf dans mods-enabled et un redémarrage. En cas de doute, il convient aussi de vérifier que le fichier de configuration httpd pointe bien vers /var/www et, si nécessaire, réinstaller les paquets apache2, libapache2-mod-php5 et mysql-server pour rétablir l'intégration PHP. Autre élément utile : certains indiquent d'activer les modules via a2enmod et d'assurer que le port 80 est ouvert, puis de relancer Apache pour que PHP soit réellement exécuté plutôt que téléchargé.
-
Contributeurbonjour,
mdr
il etait temps !!!
a+ -
Il aurait quand même été plus rapide et simple de lancer la commande
a2enmod php5
et puis
/etc/init.d/apache2 restart
au lieu de réinstaller 20 fois le packet ;) ou de créer les liens à la main-
ModérateurSalut,
Il aurait quand même été plus rapide et simple de lancer la commande
toute à fait, sauf que dans le mois de mars je ne connaissais pas encore cette commande ;-)
et franchement, je n'ai pas envie de déterrer tous mes messages pour poster la solution la plus simple et la plus courte ;-)
merci pour l'alternative, elle servira au prochain cas ;-))
-
-
En plein dans le mille!
Merci beaucoup pour le temps que tu m'as consacré!
++ -
Modérateur
sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
-
valentin@linux:/etc/samba$ ls -l /var/www total 12 drwxr-xr-x 2 root root 4096 2008-03-22 12:03 apache2-default -rw-r--r-- 1 root root 38 2008-03-22 12:46 index.php -rw-r--r-- 1 root root 20 2008-03-21 23:54 index.php~ valentin@linux:/etc/samba$ ls -ld /usr/share/phpmyadmin drwxr-xr-x 9 root root 4096 2008-03-22 16:51 /usr/share/phpmyadmin
voila :) -
Modérateuraffiche
ls -l /var/www ls -ld /usr/share/phpmyadmin
-
Alors je sais pas dis moi si je me gourre mais j'ai installé phpmyadmin et je n'y ai pas accès ...
http://192.168.1.105/phpmyadmin donne erreur 404
peut etre est ce des liens manquant aussi? -
ModérateurEn fait il te manquait (je ne sais pas pour quelle raison) les liens vers les fichiers php5.load et php5.conf http://www.commentcamarche.net/forum/affich 5570403 configuration apache?page=2#30
Bonne continuation ;-) -
Génial tu as resolu mon probleme!
un grand merci
Pourrais tu me faire un ptit recap vite fais juste pour que je comprenne bien ce qui empechait le fonctionnement ?
merci! -
valentin@linux:/$ rgrep php /etc/apache2/ /etc/apache2/mods-enabled/php5.load:LoadModule php5_module /usr/lib/apache2/modules/libphp5.so /etc/apache2/mods-enabled/php5.conf:<IfModule mod_php5.c> /etc/apache2/mods-enabled/php5.conf: AddType application/x-httpd-php .php .phtml .php3 /etc/apache2/mods-enabled/php5.conf: AddType application/x-httpd-php-source .phps /etc/apache2/mods-enabled/dir.conf: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml /etc/apache2/mods-available/php5.load:LoadModule php5_module /usr/lib/apache2/modules/libphp5.so /etc/apache2/mods-available/php5.conf:<IfModule mod_php5.c> /etc/apache2/mods-available/php5.conf: AddType application/x-httpd-php .php .phtml .php3 /etc/apache2/mods-available/php5.conf: AddType application/x-httpd-php-source .phps /etc/apache2/mods-available/dir.conf: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml valentin@linux:/$ sudo apache2 -M Loaded Modules: core_module (static) log_config_module (static) logio_module (static) mpm_prefork_module (static) http_module (static) so_module (static) alias_module (shared) auth_basic_module (shared) authn_file_module (shared) authz_default_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) dir_module (shared) env_module (shared) mime_module (shared) negotiation_module (shared) php5_module (shared) setenvif_module (shared) status_module (shared) Syntax OK
si ça y'ai pour le module! -
Modérateuraffiche aussi
rgrep php /etc/apache2/
etsudo apache2 -M
ne te donne toujours pas le moduel php ? -
ça donne ça!
valentin@linux:/$ ls -l /etc/apache2/mods-enabled/ | grep php lrwxrwxrwx 1 root root 37 2008-03-22 16:19 php5.conf -> /etc/apache2/mods-available/php5.conf lrwxrwxrwx 1 root root 37 2008-03-22 16:19 php5.load -> /etc/apache2/mods-available/php5.load
:) -
Modérateuret
ls -l /etc/apache2/mods-enabled/ | grep php
te donne quoi maintenant? -
-
valentin@linux:/$ sudo ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/php5.load valentin@linux:/$ sudo ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf valentin@linux:/$ sudo /etc/init.d/apache2 restart * Restarting web server apache2
toujours pareil ...
Merci de ton aide :) -
Modérateuressaie comme ça
sudo ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/php5.load sudo ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf sudo /etc/init.d/apache2 restart
-
valentin@linux:/$ rgrep Include /etc/apache2/ /etc/apache2/apache2.conf~:# Include module configuration: /etc/apache2/apache2.conf~:Include /etc/apache2/mods-enabled/*.load /etc/apache2/apache2.conf~:Include /etc/apache2/mods-enabled/*.conf /etc/apache2/apache2.conf~:# Include all the user configurations: /etc/apache2/apache2.conf~:Include /etc/apache2/httpd.conf /etc/apache2/apache2.conf~:# Include ports listing /etc/apache2/apache2.conf~:Include /etc/apache2/ports.conf /etc/apache2/apache2.conf~:# Options IncludesNoExec /etc/apache2/apache2.conf~:# AddOutputFilter Includes html /etc/apache2/apache2.conf~:# Include of directories ignores editors' and dpkg's backup files, /etc/apache2/apache2.conf~:# Include generic snippets of statements /etc/apache2/apache2.conf~:Include /etc/apache2/conf.d/ /etc/apache2/apache2.conf~:# Include the virtual host configurations: /etc/apache2/apache2.conf~:Include /etc/apache2/sites-enabled/ /etc/apache2/apache2.conf:# Include module configuration: /etc/apache2/apache2.conf:Include /etc/apache2/mods-enabled/*.load /etc/apache2/apache2.conf:Include /etc/apache2/mods-enabled/*.conf /etc/apache2/apache2.conf:# Include all the user configurations: /etc/apache2/apache2.conf:Include /etc/apache2/httpd.conf /etc/apache2/apache2.conf:# Include ports listing /etc/apache2/apache2.conf:Include /etc/apache2/ports.conf /etc/apache2/apache2.conf:# Options IncludesNoExec /etc/apache2/apache2.conf:# AddOutputFilter Includes html /etc/apache2/apache2.conf:# Include of directories ignores editors' and dpkg's backup files, /etc/apache2/apache2.conf:# Include generic snippets of statements /etc/apache2/apache2.conf:Include /etc/apache2/conf.d/ /etc/apache2/apache2.conf:# Include the virtual host configurations: /etc/apache2/apache2.conf:Include /etc/apache2/sites-enabled/ /etc/apache2/mods-enabled/mime.conf:# (You will also need to add "Includes" to the "Options" directive.) /etc/apache2/mods-available/userdir.conf: Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec /etc/apache2/mods-available/mime.conf:# (You will also need to add "Includes" to the "Options" directive.) valentin@linux:/$ ls -l /etc/apache2/mods-enabled/ total 0 lrwxrwxrwx 1 root root 28 2008-03-21 23:52 alias.conf -> ../mods-available/alias.conf lrwxrwxrwx 1 root root 28 2008-03-21 23:52 alias.load -> ../mods-available/alias.load lrwxrwxrwx 1 root root 33 2008-03-21 23:52 auth_basic.load -> ../mods-available/auth_basic.load lrwxrwxrwx 1 root root 33 2008-03-21 23:52 authn_file.load -> ../mods-available/authn_file.load lrwxrwxrwx 1 root root 36 2008-03-21 23:52 authz_default.load -> ../mods-available/authz_default.load lrwxrwxrwx 1 root root 38 2008-03-21 23:52 authz_groupfile.load -> ../mods-available/authz_groupfile.load lrwxrwxrwx 1 root root 33 2008-03-21 23:52 authz_host.load -> ../mods-available/authz_host.load lrwxrwxrwx 1 root root 33 2008-03-21 23:52 authz_user.load -> ../mods-available/authz_user.load lrwxrwxrwx 1 root root 32 2008-03-21 23:52 autoindex.conf -> ../mods-available/autoindex.conf lrwxrwxrwx 1 root root 32 2008-03-21 23:52 autoindex.load -> ../mods-available/autoindex.load lrwxrwxrwx 1 root root 26 2008-03-22 12:07 cgi.load -> ../mods-available/cgi.load lrwxrwxrwx 1 root root 26 2008-03-21 23:52 dir.conf -> ../mods-available/dir.conf lrwxrwxrwx 1 root root 26 2008-03-21 23:52 dir.load -> ../mods-available/dir.load lrwxrwxrwx 1 root root 26 2008-03-21 23:52 env.load -> ../mods-available/env.load lrwxrwxrwx 1 root root 27 2008-03-21 23:52 mime.conf -> ../mods-available/mime.conf lrwxrwxrwx 1 root root 27 2008-03-21 23:52 mime.load -> ../mods-available/mime.load lrwxrwxrwx 1 root root 34 2008-03-21 23:52 negotiation.conf -> ../mods-available/negotiation.conf lrwxrwxrwx 1 root root 34 2008-03-21 23:52 negotiation.load -> ../mods-available/negotiation.load lrwxrwxrwx 1 root root 31 2008-03-21 23:52 setenvif.conf -> ../mods-available/setenvif.conf lrwxrwxrwx 1 root root 31 2008-03-21 23:52 setenvif.load -> ../mods-available/setenvif.load lrwxrwxrwx 1 root root 29 2008-03-21 23:52 status.conf -> ../mods-available/status.conf lrwxrwxrwx 1 root root 29 2008-03-21 23:52 status.load -> ../mods-available/status.load
Voila :) -
Modérateuraffiche aussi
rgrep Include /etc/apache2/ ls -l /etc/apache2/mods-enabled/
-
valentin@linux:/$ sudo apache2 -M Loaded Modules: core_module (static) log_config_module (static) logio_module (static) mpm_prefork_module (static) http_module (static) so_module (static) alias_module (shared) auth_basic_module (shared) authn_file_module (shared) authz_default_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) dir_module (shared) env_module (shared) mime_module (shared) negotiation_module (shared) setenvif_module (shared) status_module (shared) Syntax OK
toujours pas apparement ... -
Modérateuraffiche maintenant
sudo apache2 -M
- 1
- 2
- 3