Annexes:ApachePHPRocky8 : Différence entre versions
(→Installation des paquets) |
|||
Ligne 1 : | Ligne 1 : | ||
− | Le plus simple est de faire une installation des paquets standards de la distribution de votre OS, mais cela requiert une connexion à un repo. Le démarrage du deamon httpd peut également se faire avec un autre utilisateur que root à condition de ne pas utiliser le port 80 pour le site. | + | Le plus simple est de faire une installation des paquets standards de la distribution de votre OS, mais cela requiert une connexion à un repo.<br> |
+ | Le démarrage du deamon httpd peut également se faire avec un autre utilisateur que root à condition de ne pas utiliser le port 80 pour le site.<br> | ||
+ | C'est exemple est une installation de Apache et PHP 7.4 sous CentOS 7.<br> | ||
==Installation des paquets== | ==Installation des paquets== | ||
− | Installation | + | Installation Apache Web Server yum : |
<pre> | <pre> | ||
− | [root@vmsqwarebox ~]# yum install httpd php php-pdo php-mysql | + | [root@vmsqwarebox ~]# yum -y update |
+ | [root@vmsqwarebox ~]# yum install httpd -y | ||
+ | </pre> | ||
+ | <br> | ||
+ | |||
+ | Démarrage et activation de apache : | ||
+ | <pre> | ||
+ | systemctl start httpd | ||
+ | systemctl enable httpd | ||
+ | systemctl status httpd | ||
+ | ## Si firewall non desactivé | ||
+ | # firewall-cmd --zone=public --permanent --add-service=http | ||
+ | # firewall-cmd --zone=public --permanent --add-service=https | ||
+ | # firewall-cmd --reload | ||
+ | </pre> | ||
+ | <br> | ||
+ | |||
+ | Test pour voir si votre site répond : | ||
+ | <pre> | ||
+ | http://10.20.30.140/ | ||
+ | </pre> | ||
+ | <br> | ||
+ | |||
+ | Activation repo + install PHP 7.4 : | ||
+ | <pre> | ||
+ | yum install subscription-manager -y | ||
+ | yum -y update && yum install epel-release -y | ||
+ | rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm | ||
+ | subscription-manager repos --enable=rhel-7-server-optional-rpms | ||
+ | |||
+ | yum-config-manager --enable remi-php74 && yum install php -y | ||
+ | php -v | ||
+ | |||
+ | yum install -y php-pdo php-mysql php-ldap | ||
+ | </pre> | ||
+ | <br> | ||
+ | |||
+ | Test pour voir si votre site répond et est configuré avec PHP 7.4 : | ||
+ | <pre> | ||
+ | systemctl restart httpd | ||
+ | |||
+ | cat <<EOFCAT >/var/www/html/phpinfo.php | ||
+ | <?php | ||
+ | |||
+ | phpinfo(); | ||
+ | |||
+ | ?> | ||
+ | EOFCAT | ||
+ | |||
+ | http://10.20.30.140/phpinfo.php | ||
</pre> | </pre> | ||
<br> | <br> |
Version du 20 décembre 2020 à 13:28
Le plus simple est de faire une installation des paquets standards de la distribution de votre OS, mais cela requiert une connexion à un repo.
Le démarrage du deamon httpd peut également se faire avec un autre utilisateur que root à condition de ne pas utiliser le port 80 pour le site.
C'est exemple est une installation de Apache et PHP 7.4 sous CentOS 7.
Sommaire
[masquer]Installation des paquets
Installation Apache Web Server yum :
[root@vmsqwarebox ~]# yum -y update [root@vmsqwarebox ~]# yum install httpd -y
Démarrage et activation de apache :
systemctl start httpd systemctl enable httpd systemctl status httpd ## Si firewall non desactivé # firewall-cmd --zone=public --permanent --add-service=http # firewall-cmd --zone=public --permanent --add-service=https # firewall-cmd --reload
Test pour voir si votre site répond :
http://10.20.30.140/
Activation repo + install PHP 7.4 :
yum install subscription-manager -y yum -y update && yum install epel-release -y rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm subscription-manager repos --enable=rhel-7-server-optional-rpms yum-config-manager --enable remi-php74 && yum install php -y php -v yum install -y php-pdo php-mysql php-ldap
Test pour voir si votre site répond et est configuré avec PHP 7.4 :
systemctl restart httpd cat <<EOFCAT >/var/www/html/phpinfo.php <?php phpinfo(); ?> EOFCAT http://10.20.30.140/phpinfo.php
Modification du php.ini
Modifiez le fichier /applis/dbsqware/php/lib/php.ini.
[root@vmsqwarebox ~]# cp -p /etc/php.ini /etc/php.ini.org [root@vmsqwarebox ~]# vi /etc/php.ini
En principe, les seules modifications à faire sont les suivantes :
;session.save_path = "/var/lib/php/session" ;session.entropy_file =
Modification du httpd.conf
Modifiez le fichier /etc/httpd/conf/httpd.conf .
Exemple de modifications (User, Group, AddType, …): ServerName sqwarebox #LoadModule php5_module modules/libphp5.so User dbsqware Group dba DirectoryIndex index.html index.php index.html.var AddType application/x-httpd-php .php
Mise en place du démarrage automatique de apache
Paramétrage du redémarrage automatique :
[root@vmsqwarebox ~]# chkconfig --list httpd httpd 0:arrêt 1:arrêt 2:arrêt 3:arrêt 4:arrêt 5:arrêt 6:arrêt [root@vmsqwarebox ~]# chkconfig httpd on [root@vmsqwarebox ~]# chkconfig --list httpd httpd 0:arrêt 1:arrêt 2:marche 3:marche 4:marche 5:marche 6:arrêt [root@vmsqwarebox ~]# service httpd restart Arrêt de httpd : [ OK ] Démarrage de httpd : [ OK ]