Hello,

j'ai un serveur dédié RPS1 chez OVH, avec une Debian Lenny dessus.
J'ai installé apache (2.2.9) sur lequel j'ai un unique virtual host:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
<VirtualHost *:80>
        # suPHP_Engine on (<== ajouté pour test, mais aucun changement)
        ServerAdmin abc@def.com
        DocumentRoot /var/www/mySiteFolder/
        ServerName sub.domain.net
        ServerAlias other.sub.domain.net
        ServerAlias *.other.sub.domain.net
</VirtualHost>
j'ai installé libapache2-mod-suphp v0.6.2-3 pour faire un script PHP capable de me relancer un démon spécifique (et ce pour différents utilisateurs du serveur, un script PHP par utilisateur).

Pour tester son fonctionnement, j'ai fait un bête script PHP de base ayant pour user 'monUser' et comme groupe 'www-data', (permissions -rw-r--r--):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
<html>
<body>
php marche-t-il ? 1+1 = <?=1+1?>
<br/><br/>
exec retourne: '<? echo exec('whoami');  ?>'
<br/><br/>
<? phpinfo(); ?>
</body>
</html>
Problème: quel que soit le propriétaire du fichier, exec("whoami") me retourne invariablement 'www-data', comme si suPHP n'était pas utilisé du tout.

Pourtant, dans le log de suPHP (/var/log/suphp/suphp.log), il lui arrive bien de mettre des choses, preuve qu'apache tente d'utiliser suPHP. exemple de lignes de log:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
[Mon Mar 22 13:00:46 2010] [warn] UID of script "/var/www/mySiteFolder/test.php" is smaller than min_uid
^^ (ceci est un exemple ; le souci d'uid n'est pas l'origine du problème puisque je continue d'observer le même comportement avec un uid valide).


Pourtant, le module suPHP est bien chargé par apache:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 ll /etc/apache2/mods-enabled/
lrwxrwxrwx 1 root root 28 mar 20 15:10 alias.conf -> ../mods-available/alias.conf
lrwxrwxrwx 1 root root 28 mar 20 15:10 alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root 33 mar 20 15:10 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root 33 mar 20 15:10 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root 36 mar 20 15:10 authz_default.load -> ../mods-available/authz_default.load
lrwxrwxrwx 1 root root 38 mar 20 15:10 authz_groupfile.load -> ../mods-available/authz_groupfile.load
lrwxrwxrwx 1 root root 33 mar 20 15:10 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root 33 mar 20 15:10 authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root 32 mar 20 15:10 autoindex.conf -> ../mods-available/autoindex.conf
lrwxrwxrwx 1 root root 32 mar 20 15:10 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root 26 mar 20 15:10 cgi.load -> ../mods-available/cgi.load
lrwxrwxrwx 1 root root 30 mar 20 15:10 deflate.conf -> ../mods-available/deflate.conf
lrwxrwxrwx 1 root root 30 mar 20 15:10 deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root 26 mar 20 15:10 dir.conf -> ../mods-available/dir.conf
lrwxrwxrwx 1 root root 26 mar 20 15:10 dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root 26 mar 20 15:10 env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root 27 mar 20 15:10 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx 1 root root 27 mar 20 15:10 mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root 34 mar 20 15:10 negotiation.conf -> ../mods-available/negotiation.conf
lrwxrwxrwx 1 root root 34 mar 20 15:10 negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root 27 mar 22 13:01 php5.conf -> ../mods-available/php5.conf
lrwxrwxrwx 1 root root 27 mar 22 13:01 php5.load -> ../mods-available/php5.load
lrwxrwxrwx 1 root root 31 mar 20 15:10 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx 1 root root 31 mar 20 15:10 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root 29 mar 20 15:10 status.conf -> ../mods-available/status.conf
lrwxrwxrwx 1 root root 29 mar 20 15:10 status.load -> ../mods-available/status.load
lrwxrwxrwx 1 root root 28 mar 22 12:50 suphp.conf -> ../mods-available/suphp.conf
lrwxrwxrwx 1 root root 28 mar 22 12:50 suphp.load -> ../mods-available/suphp.load
Le module.conf (/etc/apache2/mods-enabled/suphp.conf) est le suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
<IfModule mod_suphp.c>
        AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
        suPHP_AddHandler application/x-httpd-php
 
    <Directory />
        suPHP_Engine on
    </Directory>
 
    # By default, disable suPHP for debian packaged web applications as files
    # are owned by root and cannot be executed by suPHP because of min_uid.
    <Directory /usr/share>
        suPHP_Engine off
    </Directory>
 
# # Use a specific php config file (a dir which contains a php.ini file)
#       suPHP_ConfigPath /etc/php4/cgi/suphp/
# # Tells mod_suphp NOT to handle requests with the type <mime-type>.
#       suPHP_RemoveHandler <mime-type>
</IfModule>
Et ma config suphp (/etc/suphp/suphp.conf) est la suivante (les changements par rapport à la version 'de base' sont en gras):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[global]
;Path to logfile
logfile=/var/log/suphp/suphp.log

;Loglevel
loglevel=info

;User Apache is running as
webserver_user=www-data

;Path all scripts have to be in
docroot=/var/www

;Path to chroot() to before executing script
;chroot=/mychroot

; Security options
allow_file_group_writeable=true
allow_file_others_writeable=true
allow_directory_group_writeable=true
allow_directory_others_writeable=true

;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true

;Send minor error messages to browser
errors_to_browser=true

;PATH environment variable
env_path=/bin:/usr/bin

;Umask to set, specify in octal notation
umask=0077

; Minimum UID
min_uid=1

; Minimum GID
min_gid=1


[handlers]
;Handler for php-scripts
application/x-httpd-php=php:/usr/bin/php-cgi

;Handler for CGI-scripts
x-suphp-cgi=execute:!self
Bref, ça ne fonctionne toujours pas et j'avoue être un peu à court d'idées. Une âme charitable pourrait-elle m'éclairer ?

Merci d'avance.