Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

/usr/share/tomcat5
/usr/share/mysql

for php, I downloaded from http://php.net/downloads.php, PHP 5.3.10 (tar.gz)

i extracted the files php source to

/usr/local/src/php-5.3.10

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. –  sam Feb 3 '12 at 9:59
    
yum install httpd php php-mysql should be enough to get you started –  sam Feb 3 '12 at 10:00

2 Answers 2

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

 
discard

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.