This can't be simply done using a PHP script.
You have to get access to the clients first by installing approriate software on each client. This can be done using some kind of software deployment or remote management tools (just search the web for these keywords).
The simplest solution is to install and start a SSH server on all clients. Then you can open a SSH session to execute commands (which can be impemented using a PHP script). But this requires that you have to know the root password for all clients. See this StackExchange thread on how to do this:
software installation - How to deploy programs on multiple machines - Unix & Linux Stack Exchange[
^]
For security reasons it would be better to create a special user on the machines with disabled terminal login but allowed allowed to install software.