LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-23-2012, 01:16 PM   #1
captain_sensible
Member
 
Registered: Apr 2010
Posts: 352

Rep: Reputation: 145Reputation: 145
apache-tomcat 7.0.11 and php


I have apache-tomcat-7.0.11 installed on Slackware 13.37 on my own pc ;its working fine for testing out html and jsp’s from the root directory which is:

/var/lib/tomcat/webapps/ROOT

I was wondering if I can enable php ,for example by putting a simple file such as info.php with code
<?php
phpinfo();
?>

into the above ROOT directory, and using web browser at:
http://localhost:8080/info.php

I know some people use apache for php,and then get apache-tomcat to handle jsp requests(probably too complicated for me). Or they use xampp for html and php.

I'm not running any live system,only for testing and it would make sense to have files php,jsp,html all in one place i.e
/var/lib/tomcat/webapps/ROOT

Is it fairly easy to do?
 
Old 01-23-2012, 02:14 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Not sure I understand what you want to achieve.

Of course Apache (the web server) can handle php files, provided you set up properly its configuration files: see httpd.conf, php.ini and mod-php.conf in /etc/httpd.

By default in Slackware the document root is /srv/httpd/htdocs, which is a symlink to /var/www/htdocs (configured /etc/httpd/httpd.conf)

Other than that I really don't not know what Tomcat has to do with php ???
 
Old 01-23-2012, 03:08 PM   #3
captain_sensible
Member
 
Registered: Apr 2010
Posts: 352

Original Poster
Rep: Reputation: 145Reputation: 145
ok

i'm using apache-tomcat as a web server ,which serves up html and java server pages at url http://localhost:8080 this is the one that I also want to serve up php.


This is in contrast to the apache web server which serves up html, and php at url

http://localhost:80

they can both be used as web servers- i'm using the tomcat one which doesn't as a rule serve up php

Last edited by captain_sensible; 01-23-2012 at 03:10 PM.
 
Old 01-23-2012, 03:20 PM   #4
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,097

Rep: Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174
you can try this

http://php-java-bridge.sourceforge.net/doc/tomcat6.php

or (who knows) this
http://wiki.apache.org/tomcat/UsingPhp

but it makes much more sense to me to use apache as a frontend to serve html and redirect from it php requests to mod_php and java stuff to apache-tomcat (with mod_proxy).

Last edited by ponce; 01-23-2012 at 03:23 PM.
 
Old 01-23-2012, 04:27 PM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Or if you only want to use the port #8080 instead of 80, just replace "Listen 80" with "Listen 8080" in /etc/httpd/httpd.conf - and use another port for Tomcat, if you still need it
 
Old 01-24-2012, 01:57 PM   #6
captain_sensible
Member
 
Registered: Apr 2010
Posts: 352

Original Poster
Rep: Reputation: 145Reputation: 145
thanks for the replies. ponce thanks will read up from the links, it may be too complicated for someone at my level.

another option is xammp,played with it and found that after manually starting both xampp and tomcat ,a jsp using

con =DriverManager.getConnection("jdbc:mysql://localhost/andrew_accra","andrew","oburoni");

somehow does connect with the MySQL element in xammp ,and returns data showing tomcat7 from a slackbuild can connect with xammp. I wonder if I could get it to work the other way around?

i.e get the apache part of xammp to request tomcat to handle a jsp. Obviously apache in xammp isn't actually installed though as in an normal tomcat7 apache integration setup
 
Old 01-24-2012, 08:23 PM   #7
rouvas
Member
 
Registered: Aug 2006
Location: Greece
Distribution: Slackware.12.2
Posts: 104
Blog Entries: 3

Rep: Reputation: 21
You can also try: http://quercus.caucho.com/ if you absolutely must have PHP and Java on the same web server
 
Old 06-12-2012, 12:35 PM   #8
captain_sensible
Member
 
Registered: Apr 2010
Posts: 352

Original Poster
Rep: Reputation: 145Reputation: 145
Recently I have had some extra time and had another look at php and tomcat. Basically All I was trying to do was get php files to run on tomcat for a school web server set up allowing use of jsp,html,and php . This combination should just about cover everything for web development for schools; this article expresses my thinking :

http://www.thomasknierim.com/140/jav...p-with-tomcat/

The solution was easier than I thought , maybe I just got lucky?

I just put JavaBridgeTemplate621.war (see http://sourceforge.net/projects/php-...-bridge_6.2.1/ for download)

into the webapps directory of tomcat ,stopedc and re-started tomcat, which unpacked the war.I found test.php and index.jsp in the unpacked JavaBrideTemplate621 directory. Then I found http://localhost:8080/JavaBridgeTemplate621/index.php then displayed perfectly also test.php worked fine displaying loads of info. test.php was found to contain the code phpinfo()

In summary I can now get php files to run from within tomcat
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Please help with Apache Web Server / Apache Tomcat / PHP / Java / PHP-Java Bridge jpmad4it Linux - Server 2 01-05-2009 06:07 AM
Slackware 10.2 + Mysql + Apache + PHP + Tomcat Black187 Slackware 5 11-16-2005 07:11 AM
Slackware 10.2 + Mysql + Apache + PHP + Tomcat Black187 Linux - General 1 11-16-2005 02:11 AM
apache + php + tomcat berrance Linux - Software 1 08-08-2005 07:33 AM
tomcat with apache +php gigya Linux - Software 2 01-30-2004 10:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration