Apparmor default profile doesn't allow to ping hosts from apache2.
If Your create ping.php with contents:
<?php
///$result = shell_exec('su -pc "ping -c3 172.20.2.42" 2>&1');
$result = shell_exec('sudo -u www-data ping -c3 172.20.2.4 2>&1');
print "<pre>$result</pre>";
?>
ping: socket: Operation not permitted
I've got Debian Buster from proxmox repository template.
How to change that behaviour?
All the networking software is using ICMP ping to check if host is alive.
If Your create ping.php with contents:
<?php
///$result = shell_exec('su -pc "ping -c3 172.20.2.42" 2>&1');
$result = shell_exec('sudo -u www-data ping -c3 172.20.2.4 2>&1');
print "<pre>$result</pre>";
?>
ping: socket: Operation not permitted
I've got Debian Buster from proxmox repository template.
How to change that behaviour?
All the networking software is using ICMP ping to check if host is alive.