![]() |
![]() |
||||
Thanks to the wonderful people at Resin, most PHP applications and websites can be used with Tomcat by installing Quercus.
Traditional PHP hosting introduces a number of security issues due to the way Apache runs all sites under the same www-data account. There are a number of work-arounds, but it's a continual balancing act between performance, flexibility and security.
PHP binaries are written in C, so new buffer overflows and similar issues are reported and fixed monthly by the PHP developers.
By using Quercus to run PHP at Metawerx, security is handled by your already secured metawerx java hosting account. PHP binaries are not used, because everything is recompiled into Java on the fly and run by the Java VM, as 100% java instead.
With Quercus, PHP is compiled into java classes when you change it (like JSP) and then gets all the performance benefits from Java and the HotSpot compiler.
For a normal PHP request, the PHP script is loaded, parsed and executed in separate processes. These are much slower than a Java VM running java classes in separate threads. PHP professionals increase the performance of their systems using caching methods and utilities to keep a PHP instance in memory rather than loading a new instance for each request. With Java, we don't have to worry about that however, because the PHP is compiled into java classes and run by the Java VM.
According to a performance report by Aaron Stewart using Drupal (a popular PHP application), Quercus ran on Resin at around 3.5-4x faster than a standard PHP install.
There is also a great article on JavaLobby about Quercus that is worth a read if you are planning on moving from a PHP-based host to Tomcat or Resin as your PHP engine of choice.
You can install Quercus into your application directly by checking the entries in it's web.xml file, and importing the libraries in it's lib folder, or as a separate application.
This guide will show how to install it as a separate application.
You should now be able to access http://yoursite/php and see the Quercus test index.php file
Most PHP software works fine with Quercus, so upload some PHP and try it out, or continue below to install some popular PHP software.