Salut,
Je voulais effectuer quelques test locaux en PHP, donc quelquechose de rapide et non sécurisé (http n'écoute que sur 127:0:0:1 par exemple), mais : je ne trouve pas une solution rapide qui fonctionne pour créer les fichiers ....
En fait, j'avais dabord essayé avec mon user, donc je pensais que à un moment ou à un autre le serveur bloquait l'accès. Donc je suis repassé à apache:apache.
Mon script :
<?php
touch("ok.txt");
Situé dans :
/var/www/html/shnoulle/
# ls -la /var/www/html/shnoulle/
total 24
drwxr-xr-x. 3 apache apache 4096 22 mai 17:36 .
drwxr-xr-x. 3 root root 4096 20 mai 08:59 ..
-rw-r-----. 1 apache apache 123 21 mai 09:38 index.php
-rw-r-----. 1 apache apache 17 20 mai 09:01 info.php
drwxrwxr-x. 18 apache apache 4096 21 mai 09:17 LimeSurvey
-rw-r-----. 1 apache apache 23 22 mai 17:31 test.php
# grep "User" /etc/httpd/conf/httpd.conf
User apache
Résultat:
Warning: touch(): Unable to create file ok.txt because Permission denied in /var/www/html/shnoulle/test.php on line 2
Le log en mode debug:
[Fri May 22 17:44:51.486557 2015] [proxy:debug] [pid 15994] proxy_util.c(1771): AH00925: initializing worker proxy:reverse shared
[Fri May 22 17:44:51.486608 2015] [proxy:debug] [pid 15994] proxy_util.c(1813): AH00927: initializing worker proxy:reverse local
[Fri May 22 17:44:51.486666 2015] [proxy:debug] [pid 15994] proxy_util.c(1864): AH00931: initialized single connection worker in child 15994 for (*)
[Fri May 22 17:44:51.487886 2015] [proxy:debug] [pid 15997] proxy_util.c(1771): AH00925: initializing worker proxy:reverse shared
[Fri May 22 17:44:51.487945 2015] [proxy:debug] [pid 15997] proxy_util.c(1813): AH00927: initializing worker proxy:reverse local
[Fri May 22 17:44:51.488005 2015] [proxy:debug] [pid 15997] proxy_util.c(1864): AH00931: initialized single connection worker in child 15997 for (*)
[Fri May 22 17:44:51.489314 2015] [proxy:debug] [pid 15998] proxy_util.c(1771): AH00925: initializing worker proxy:reverse shared
[Fri May 22 17:44:51.489370 2015] [proxy:debug] [pid 15998] proxy_util.c(1813): AH00927: initializing worker proxy:reverse local
[Fri May 22 17:44:51.489427 2015] [proxy:debug] [pid 15998] proxy_util.c(1864): AH00931: initialized single connection worker in child 15998 for (*)
[Fri May 22 17:44:51.512319 2015] [:warn] [pid 15993] ./mod_dnssd.c: No services found to register
[Fri May 22 17:45:05.559780 2015] [authz_core:debug] [pid 15996] mod_authz_core.c(802): [client 127.0.0.1:58488] AH01626: authorization result of Require all granted: granted
[Fri May 22 17:45:05.559837 2015] [authz_core:debug] [pid 15996] mod_authz_core.c(802): [client 127.0.0.1:58488] AH01626: authorization result of <RequireAny>: granted
[Fri May 22 17:45:05.559986 2015] [authz_core:debug] [pid 15996] mod_authz_core.c(802): [client 127.0.0.1:58488] AH01626: authorization result of Require all granted: granted
[Fri May 22 17:45:05.560019 2015] [authz_core:debug] [pid 15996] mod_authz_core.c(802): [client 127.0.0.1:58488] AH01626: authorization result of <RequireAny>: granted
[Fri May 22 17:45:05.560137 2015] [authz_core:debug] [pid 15996] mod_authz_core.c(802): [client 127.0.0.1:58488] AH01626: authorization result of Require all granted: granted
[Fri May 22 17:45:05.560159 2015] [authz_core:debug] [pid 15996] mod_authz_core.c(802): [client 127.0.0.1:58488] AH01626: authorization result of <RequireAny>: granted
[Fri May 22 17:45:05.561163 2015] [:error] [pid 15996] [client 127.0.0.1:58488] PHP Warning: touch(): Unable to create file ok.txt because Permission denied in /var/www/html/shnoulle/test.php on line 2
un get_current_user en PHP me montre bien apache ....
selinux ?
Denis