Perhaps too big of a hammer for your particular case, but this tool may actually open up possibilities you never imagined before. Take a look at Puppet. It's a configuration management tool that allows you to control your clients in a centralized and OS-agnostic manner.
In Puppet, you ensure that a certain package is installed by writing something similar to the following in a configuration file (on the server):
$package_name = $operatingsystem ? {
debian => 'apache-for-debian',
redhat => 'apache-for-rhel',
default => 'apache',
}
package{$package_name: ensure => installed}
As for your home-brewed PHP script, you can put it under Puppet's tree on your server and have the clients download it with something similar to the following:
file{'my_script':
ensure => file, #as opposed to directory
path => '/path/on/client/myscript',
mode => 0755,
source => 'puppet:///path/on/server/myscript',
}
You can have Puppet check periodically for changes in the configuration on the server and mirror them on the local host (client). This means that maintaining your PHP script after installation is also centralized.