Will installing apache for PHP and Tomcat give problems?

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Will installing apache for PHP and Tomcat give problems?

Post by raghavan20 »

I already have Tomcat running in my local system for JSP and I am thinking of installing Apache for running PHP. Will it pose any problems if two apaches are running on the same machine? I do not have a great deal of knowledge with Web Servers so do explain me as if I were a novice.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

just run them on different ports...thats what i did when i had IIS and Apache running
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Different ports, mod_proxy, ... there are quite a lot of options to run multiple servers :)

If i'm not mistaken, you can also choose to add a mod_tomcat (just as mod_php) to your webserver, and run them both in the same apache instance...
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

I have let the Tomcat run in 8080 instead of changing it to 80 so I hope when installing Apache it should automatically run from 80.

I downloaded the zip file from the following description...

Code: Select all

Win32 Source: httpd-2.0.55-win32-src.zip [PGP] [MD5]
I do not see a installation file in the zip file I downloaded. How do I install it or is it possible to manually start the server without configuring it?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You downloaded the source. You'll need a C compiler to compile and install it. Get the binary if you're in windows unless you're into compiling stuff (which you're clearly not or you would have known).

Running one one 8080 and one on 80 will work fine yes :)
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

You are right and I am not into the compiling stuff. But why in the World one would want to compile if direct installation file is available?

I have tried to install apache in my local machine....What values should I supply for network domain and server name?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

raghavan20 wrote:You are right and I am not into the compiling stuff. But why in the World one would want to compile if direct installation file is available?

I have tried to install apache in my local machine....What values should I supply for network domain and server name?
Compiling leads to faster performance since the application was built on your CPU ;) Some people also enjoy it and of course, that what open source is for :)

We cannot possibly answer that last question for you, I assume you not wanting to use localhost or you wouldn;t have asked? You should know those details.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

1. I am trying to install PHP 4.4.2. There are two files available, one is a zip file and the other is a installation file.
I have downloaded the installation file and installed it. The apache tutorial says to alter httpd.conf file, it wants me to add a new line

Code: Select all

LoadModule php4_module c:/php-version/sapi/php4apache2.dll
There is no sapi folder in the installation package.

2. Where should I put my php files so that apache recognizes it?
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

I have now downloaded php4.4.2 zip package and extracted to j:
I found the sapi folder inside this installation directory.
I have added the line for loading the module from the sapi directory but the apache reports that module cannot be found in that path....

Code: Select all

#LoadModule cern_meta_module modules/mod_cern_meta.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule php4_module j:/php-4.4.2/sapi/php4apache2.dll

Reported error by apache:
Syntax error on line 193 of j:/apache/apache/conf/httpd.conf:
Cannot load j:/php-4.4.2/sapi/php4apache2.dll into server: (126) The specified m
odule could not be found:

Note the errors or messages above, and press the <ESC> key to exit.  28...


This is the path returned by windows for php4apache2.dll
J:\php-4.4.2\sapi
I see now that I have to put php files under htdocs folder but I already I see a lot of files in there. In apache, is it not possible to put the files outside and refer to it. Anyway, I created a test folder and put a new php file into it. But when I try to run it, the file gets downloaded instead of running, I think this is because of the failure to run the module...
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Check the paths for the modules in httpd.conf, they should not be absolute like that and also look at DocumentRoot. You can delete all those files in htdocs... thay're just web pagesthere by default.
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

As you said, paths are not absolute for directories within the apache package. But the dll file from sapi directory in PHP package has to be referenced as absolute. This was not the problem earlier but the book did not tell me to add module which I learnt from PHP.net and now all my php files run properly.

Code: Select all

LoadModule php4_module j:/php-4.4.2/sapi/php4apache.dll

AddModule mod_php4.c
Post Reply