Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to install php on a CentOS machine and configure it to work with tomcat5 and mysql

Anyone know how i can do this?

the home folder for tomcat and mysql is


for php, I downloaded from, PHP 5.3.10 (tar.gz)

i extracted the files php source to


Now I'm unsure on how to proceed with the installation of php to work with tomcat5 and mysql..

Need help.

Thanks in advance.

share|improve this question
Tomcat is a Java application server. While it is technically possible to run a PHP application within Tomcat, you need to do all sorts of patching and other stuff making it non-ideal. Just use Apache HTTPD and mod_php, save yourself a lot of trouble. – Smudge Feb 3 '12 at 9:59
yum install httpd php php-mysql should be enough to get you started – Smudge Feb 3 '12 at 10:00

I support sam idea of using apache (or httpd as called on centos) instead of tomcat to run PHP.

All you need to get started is to install httpd, php module, and php-mysql module. After installing the required modules, you need to reload/restart your httpd server.

If you still need to have tomcat installed to run Java-based services, you can still do that by installing both apache and tomcat. You can use apache module mod-jk to link them together. In this case, the requests will be received by apache and it will forward the relevant requests to tomcat (according to configuration) which should be running on different port (other than 80).

share|improve this answer

You can run PHP in Java using Quercus but like the others have said unless you have some unusual requirement to use Tomcat as the HTTP server you're really better off using Apache and mod_php.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.