I want to offer binary downloads on my own web-space, which is capable of running PHP and has MySQL database connectivity. I want to see download statistics (total numbers, maybe also by OS or by geographical origin) and I want to be able to display advertisements (for example from Google). I'm looking for a PHP powered software that can do that and is gratis. I can do the upload per FTP. The software should be secure.
Required: PHP, download capability, display statistics & ads, gratis
Bonus points for: Easy to use interface to manage offered downloads, Customizable layout, Permissive license (so I can adapt the software further)