Sur un de mes serveur Debian lenny je souhaite exécuter un script php donc voici un extrait :
et comme résultat je reçoit le message suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 $resultat = exec('netstat -natpu', $lines); foreach($lines as $line){ $output.=$line; echo $line .'<br />' ; }
Par contre quand je passe par le terminal de mon serveur linux
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 Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:41895 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:620 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN - tcp 0 0 86.65.xxx.xxx:53 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN - tcp 0 0 86.65.xxx.xxx:22 82.125.xxx.xxx:49857 ESTABLISHED - tcp 0 0 127.0.0.1:57843 127.0.0.1:3306 TIME_WAIT - tcp 0 0 86.65.xxx.xxx:22 82.125.xxx.xxx:50483 ESTABLISHED - tcp 0 0 86.65.xxx.xxx:22 82.125.xxx.xxx:50082 ESTABLISHED - tcp6 0 0 :::993 :::* LISTEN - tcp6 0 0 :::995 :::* LISTEN - tcp6 0 0 :::110 :::* LISTEN - tcp6 0 0 :::143 :::* LISTEN - tcp6 0 0 :::80 :::* LISTEN 26240/netstat tcp6 0 0 :::53 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - tcp6 0 0 ::1:953 :::* LISTEN - tcp6 0 0 :::443 :::* LISTEN 26240/netstat tcp6 0 0 86.65.xxx.xxx:80 82.125.xxx.xxx:50525 ESTABLISHED 26240/netstat udp 0 0 127.0.0.1:921 0.0.0.0:* - udp 0 0 86.65.xxx.xxx:53 0.0.0.0:* - udp 0 0 127.0.0.1:53 0.0.0.0:* - udp 0 0 0.0.0.0:60488 0.0.0.0:* - udp 0 0 0.0.0.0:717 0.0.0.0:* - udp 0 0 0.0.0.0:111 0.0.0.0:* - udp 0 0 86.65.xxx.xxx:123 0.0.0.0:* - udp 0 0 127.0.0.1:123 0.0.0.0:* - udp 0 0 0.0.0.0:123 0.0.0.0:* - udp6 0 0 :::53 :::* - udp6 0 0 fe80::20f:b5ff:feaa:123 :::* - udp6 0 0 ::1:123 :::* - udp6 0 0 :::123 :::* -
en executant la commande
je reçoit ses informations:
Code : Sélectionner tout - Visualiser dans une fenêtre à part netstat -natpu
En exécutant le script php je ne reçoit pas les informations de la colonne PID/Program name!
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 Connexions Internet actives (serveurs et établies) Proto Recv-Q Send-Q Adresse locale Adresse distante Etat PID/Program name tcp 0 0 0.0.0.0:41895 0.0.0.0:* LISTEN 1813/rpc.statd tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 2225/mysqld tcp 0 0 127.0.0.1:620 0.0.0.0:* LISTEN 2564/famd tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1802/portmap tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 2425/master tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 14716/inetd tcp 0 0 86.65.xxx.xxx:53 0.0.0.0:* LISTEN 2113/named tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2113/named tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2148/sshd tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2425/master tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 2113/named tcp 0 0 86.65.xxx.xxx:22 82.125.xxx.xxx:49857 ESTABLISHED 26026/sshd: cabinet tcp 0 0 86.65.xxx.xxx:22 82.125.xxx.xxx:50483 ESTABLISHED 26187/sshd: cabinet tcp 0 300 86.65.xxx.xxx:22 82.125.xxx.xxx:50543 ESTABLISHED 26247/0 tcp 0 0 86.65.xxx.xxx:22 82.125.xxx.xxx:50082 ESTABLISHED 26084/sshd: cabinet tcp6 0 0 :::993 :::* LISTEN 2316/couriertcpd tcp6 0 0 :::995 :::* LISTEN 2334/couriertcpd tcp6 0 0 :::110 :::* LISTEN 2322/couriertcpd tcp6 0 0 :::143 :::* LISTEN 2304/couriertcpd tcp6 0 0 :::80 :::* LISTEN 2716/apache2 tcp6 0 0 :::53 :::* LISTEN 2113/named tcp6 0 0 :::22 :::* LISTEN 2148/sshd tcp6 0 0 ::1:953 :::* LISTEN 2113/named tcp6 0 0 :::443 :::* LISTEN 2716/apache2 udp 0 0 127.0.0.1:921 0.0.0.0:* 2131/lwresd udp 0 0 86.65.xxx.xxx:53 0.0.0.0:* 2113/named udp 0 0 127.0.0.1:53 0.0.0.0:* 2113/named udp 0 0 0.0.0.0:60488 0.0.0.0:* 1813/rpc.statd udp 0 0 0.0.0.0:717 0.0.0.0:* 1813/rpc.statd udp 0 0 0.0.0.0:111 0.0.0.0:* 1802/portmap udp 0 0 86.65.xxx.xxx:123 0.0.0.0:* 2583/ntpd udp 0 0 127.0.0.1:123 0.0.0.0:* 2583/ntpd udp 0 0 0.0.0.0:123 0.0.0.0:* 2583/ntpd udp6 0 0 :::53 :::* 2113/named udp6 0 0 fe80::20f:b5ff:feaa:123 :::* 2583/ntpd udp6 0 0 ::1:123 :::* 2583/ntpd udp6 0 0 :::123 :::* 2583/ntpd root@debian:~#
Quelqu'un à une idée pourquoi les commandes exec et netstat me livrent des informations incomplètes quand celles-ci sont exécuté avec le code php?
J'ai l'impression que tous les informations qui dépassent les 80 caractères/ligne sont ignoré ... c'est le cas de de la colonne PID/Program name.
Merci d'avance pour votre aide.![]()








Répondre avec citation
Partager