VPS vs Shared Hosting
Source: Compare Hosting: VPS vs Shared
Shared hosting is cheaper.
VPS offers full control. You can install custom software. You can use custom ports and configure your firewall.
VPS offers high degree of privacy and isolation, minimizing the risk of unauthorized access from hackers as well as other customers.
The isolation of your account also minimizes the risk of being impacted by a DoS attack that was intended for someone else
On VPS the level of sharing is smaller. The service will run more reliably and predictably. On VPS portions of the resources are always dedicated to each account.
This allows for more power and flexibility than being on a shared account.
When it's time start supporting heavy traffic and custom applications, many will make the switch to VPS hosting after encountering the limitations of the shared hosting infrastructure.
On shared hosting accounts share all hardware resources with "soft" limits imposed by monitoring software (shared hosting servers are notoriously over-sold, often to the detriment of individual accounts).
Virtual private servers are allotted disk space and memory independent of other allocations on the hardware node; while the potential for individual accounts to affect hardware node performance still exists, hard limits set for each virtual environment and improved monitoring capabilities minimize the opportunities for a single user's activities to impact others.
These individuals will prefer Shared Hosting for its perceived simplicity and ease of use: they generally do not have Linux system administration experience and they are not interested in picking up any.
Shared hosting is inherently difficult to secure completely - as multiple users have the ability to upload and download files which can be run under the same operating system instance which supports other users' accounts, the possibility for a malicious user to exploit an operating system vulnerability and gain access to other users' data will always exist.
It is no accident that the word "Private" makes an appearance between "Virtual" and "Server" - VPS hosting is inherently more secure than shared hosting: its virtual environments have independent file systems and its administrators are empowered to implement secure configurations.
Java vs PHP for Web Applications
Source: PHP vs. Java
First of all only for server-side programming, the comparison between Java and PHP makes sense.
Almost all web hosting companies use Apache Server/PHP.
PHP is easier for begginers. Doesn't mean they can write good code.
Java is compiled and strongly-typed language. PHP is a dynamic typed language.
Java has a richer set of API.
Java provides a clean mechanism to combine libraries (jar) to compose a complex application.
Java provides native transaction mechanism.
Java has a persistence mechanism to convert Java objects to database table entries and table entries to Java objects. Object-relational mapping.
Java has thread support: Executing tasks in parallel.
Java provides management API (JMX) for managing and monitoring devices and applications.
Java has many fabulous editors: Eclipse, Netbeans and Intellij. For the productivity and the management of big project code, a complex editor is essential.
PHP has a plug-in for Netbeans and Eclipse but very limited.
All Java editors allow you to debug your project within the editor.
PHP debugging is just “print” statements.
Packaging and Deployment
Java has many packaging and deployment utilities: Ant, Maven, Editors, Web Start etc.
PHP are just files. No packaging concept.
Java Application servers enforce security model. Each application runs in its own container.
Java/JVM has its own extensive security framework.
No security guarantees from PHP: Administrators run PHP in CGI mode in order to avoid security nightmare. That is, PHP engine is forked for each page hit.
Even Administrator chroots (each time to you hit a page) for security.
JVM is optimized for performance and memory footprint: Just- In-Time-Compilation (JIT).
Java compiles JSP files and JITs hot spots automatically.
PHP parses the file and output the stream for each call. No compilation. Furthermore, in CGI model compilation doesn’t make sense.
JVM has object caching mechanism.
In Java Application Server, you could do connection-pooling. That is, a pool of connections can be shared by different client requests.
In Java, the session is maintained on the server for the client where in CGI model session is destroyed each time.