The title explains most of my question. The OS is linux (Lubuntu). The servers are Apache2 (PHP5), MySQL 5.6 and FTP (Samba).
You can prevent hacking to an extent however, nothing is perfect and there are always flaws in any system. Asking a question with such little detail prevents a comprehensive insightful answer. It's advisable to read up and practice Linux and PHP security concepts. However it's impossible to make your website "hackproof", you can make it "hack-resistant" though. Secure the core, code your application securely and it might not be a bad idea to invest in a firewall on the network, server and web application layers.