To get php (server side scripts) for apache sudo apt install php libapache2-mod-php -y
Create a test php script
cd /var/www/html
sudo touch php.php
sudo mc and add
<html>
<body>
<?php
phpinfo();
?>
</body>
</html>
As whoami shows PHP script run as user www-data.
PHP has just the rights of the user www-data and might not run system commands commands
There are very good reason why this is like that.
It is more secure to run a cron service and write data to the disk (ram disk /run if it changes frequently) then have php directly get the data.