Vous êtes : Accueil / Tutoriaux / Apache, MySQL et PHP sous Gentoo

Apache, MySQL et PHP sous Gentoo

Rédigé le 05/04/2005 par Greg

Introduction

Editer le fichier make.conf afin de rajouter les variables suivante:

# nano /etc/make.conf
USE="apache2 mysql"

On vas installer "Apache, PHP et MySQL"

# emerge apache mod_php mysql
# ebuild /var/db/pkg/dev-php/mod_php-4.3.3-r3/mod_php-4.3.3-r3.ebuild config

On vas spécifier a Apache de charger l'option PHP

# nano /etc/conf.d/apache2
et ajouter "-D PHP4" dans "APACHE2_OPTS"

On install la base de donnée de MySQL

# /usr/bin/mysql_install_db
# /etc/init.d/mysql start
On déffini un mot de passe pour le compte root
# /usr/bin/mysqladmin -u root password 'votre mot de passe'

Ensuite, le fichier "commonapache2.conf", on ajoute les prise en charge d'extension:

# /etc/apache2/conf/commonapache2.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps

Modifié la ligne DirectoryIndex pour avoir la chose suivante :

DirectoryIndex index.html index.php index.php3 index.shtml index.cgi index.pl index.htm Default.htm default.htm index.html.var

Dans /etc/apache2/conf/mime.types, ajoutez :

application/x-httpd-php php
application/x-httpd-php phtml
application/x-httpd-php php3
AddType application/x-httpd-php php4
AddType application/x-httpd-php-source phps

On install PhPmyAdmin pour faciliter l'utilisation de MySQL

# emerge phpmyadmin
# etc-update

# ebuild /var/db/pkg/dev-db/phpmyadmin-2.5.4/phpmyadmin-2.5.4.ebuild config # /etc/init.d/mysql restart
Pour accéder a PhPmyAdmin taper cette url dans votre navigateur préféré
http://localhost/phpmyadmin/

Et enfin, on ajoute MySQL et Apache au service de démarrage:

# rc-update add apache2 default
# rc-update add mysql default
Page suivante >