Annexes:ApachePHPRocky8 : Différence entre versions

De WikiFr_dbSQWare
Aller à : navigation, rechercher
Ligne 7 : Ligne 7 :
 
Installation Apache Web Server yum :
 
Installation Apache Web Server yum :
 
<pre>
 
<pre>
[root@vmsqwarebox ~]# yum -y update
+
[root@VMsqwarebox ~]# yum -y update
[root@vmsqwarebox ~]# yum install httpd -y
+
[root@VMsqwarebox ~]# yum install httpd -y
 
</pre>
 
</pre>
 
<br>
 
<br>
Ligne 65 : Ligne 65 :
 
Modifiez le fichier /etc/php.ini
 
Modifiez le fichier /etc/php.ini
 
<pre>
 
<pre>
[root@vmsqwarebox ~]# cp -p /etc/php.ini /etc/php.ini.org
+
[root@VMsqwarebox ~]# cp -p /etc/php.ini /etc/php.ini.org
[root@vmsqwarebox ~]# vi /etc/php.ini
+
[root@VMsqwarebox ~]# vi /etc/php.ini
 
</pre>
 
</pre>
 
<br>
 
<br>
Ligne 79 : Ligne 79 :
 
Modifiez le fichier /etc/httpd/conf.d/php.conf
 
Modifiez le fichier /etc/httpd/conf.d/php.conf
 
<pre>
 
<pre>
[root@vmsqwarebox ~]# cp -p /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.org
+
[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
+
[root@VMsqwarebox ~]# vi /etc/httpd/conf.d/php.conf
 
</pre>
 
</pre>
 
<br>
 
<br>
Ligne 95 : Ligne 95 :
 
Modifiez le fichier /etc/httpd/conf/httpd.conf
 
Modifiez le fichier /etc/httpd/conf/httpd.conf
 
<pre>
 
<pre>
[root@vmsqwarebox ~]# cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
+
[root@VMsqwarebox ~]# cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org
[root@vmsqwarebox ~]# vi /etc/httpd/conf/httpd.conf
+
[root@VMsqwarebox ~]# vi /etc/httpd/conf/httpd.conf
 
</pre>
 
</pre>
 
<br>
 
<br>

Version du 15 avril 2023 à 17:04

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