Annexes:ApachePHPRocky8 : Différence entre versions

De WikiFr_dbSQWare
Aller à : navigation, rechercher
(Modification du php.ini)
Ligne 93 : Ligne 93 :
 
==Modification du httpd.conf==
 
==Modification du httpd.conf==
  
Modifiez le fichier /etc/httpd/conf/httpd.conf .
+
Modifiez le fichier /etc/httpd/conf/httpd.conf
 
<pre>
 
<pre>
Exemple de modifications (User, Group, AddType, …):
+
[root@vmsqwarebox ~]# cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
ServerName sqwarebox
+
[root@vmsqwarebox ~]# vi /etc/httpd/conf/httpd.conf
#LoadModule php5_module modules/libphp5.so
 
User dbsqware
 
Group dba
 
DirectoryIndex index.html index.php index.html.var
 
AddType application/x-httpd-php .php
 
 
</pre>
 
</pre>
 
<br>
 
<br>
  
==Mise en place du démarrage automatique de apache==
+
En principe, les seules modifications à faire sont les suivantes :
 
 
Paramétrage du redémarrage automatique :
 
 
<pre>
 
<pre>
[root@vmsqwarebox ~]# chkconfig --list httpd
+
User dbsqware
httpd          0:arrêt 1:arrêt 2:arrêt 3:arrêt 4:arrêt 5:arrêt 6:arrêt
+
Group dba
[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  ]
 
 
</pre>
 
</pre>
 
<br>
 
<br>

Version du 20 décembre 2020 à 13:35

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.
Cet exemple est une installation de Apache et PHP 7.4 sous CentOS 7.

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 + php.conf

Modifiez le fichier /etc/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 = "/tmp"
;session.entropy_file =


Modifiez le fichier /etc/httpd/conf.d/php.conf

[root@vmsqwarebox ~]# cp -p /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.org
[root@vmsqwarebox ~]# vi /etc/httpd/conf.d/php.conf


En principe, les seules modifications à faire sont les suivantes :

#php_value session.save_path    "/var/lib/php/session"
php_value session.save_path    "/var/tmp"


Modification du httpd.conf

Modifiez le fichier /etc/httpd/conf/httpd.conf

[root@vmsqwarebox ~]# cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
[root@vmsqwarebox ~]# vi /etc/httpd/conf/httpd.conf


En principe, les seules modifications à faire sont les suivantes :

User dbsqware
Group dba