Annexes:ApachePHPRocky8 : Différence entre versions

De WikiFr_dbSQWare
Aller à : navigation, rechercher
(Installation des paquets)
(Modification du php.ini)
Ligne 61 : Ligne 61 :
 
<br>
 
<br>
  
==Modification du php.ini==
+
==Modification du php.ini + php.conf==
  
Modifiez le fichier /applis/dbsqware/php/lib/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
Ligne 72 : Ligne 72 :
 
En principe, les seules modifications à faire sont les suivantes :
 
En principe, les seules modifications à faire sont les suivantes :
 
<pre>
 
<pre>
;session.save_path = "/var/lib/php/session"
+
;session.save_path = "/tmp"
 
;session.entropy_file =
 
;session.entropy_file =
 +
</pre>
 +
<br>
 +
 +
Modifiez le fichier /etc/httpd/conf.d/php.conf
 +
<pre>
 +
[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
 +
</pre>
 +
<br>
 +
 +
En principe, les seules modifications à faire sont les suivantes :
 +
<pre>
 +
#php_value session.save_path    "/var/lib/php/session"
 +
php_value session.save_path    "/var/tmp"
 
</pre>
 
</pre>
 
<br>
 
<br>

Version du 20 décembre 2020 à 13:33

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 .

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  ]