LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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, 02:16 PM   #1
captain_sensible
Member
 
Registered: Apr 2010
Posts: 72

Rep: Reputation: 0
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, 03:14 PM   #2
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad W520
Posts: 4,679

Rep: Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240
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, 04:08 PM   #3
captain_sensible
Member
 
Registered: Apr 2010
Posts: 72

Original Poster
Rep: Reputation: 0
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 04:10 PM.
 
Old 01-23-2012, 04:20 PM   #4
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,504

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
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 04:23 PM.
 
Old 01-23-2012, 05:27 PM   #5
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad W520
Posts: 4,679

Rep: Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240Reputation: 1240
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, 02:57 PM   #6
captain_sensible
Member
 
Registered: Apr 2010
Posts: 72

Original Poster
Rep: Reputation: 0
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, 09:23 PM   #7
rouvas
Member
 
Registered: Aug 2006
Location: Greece
Distribution: Slackware.12.2
Posts: 85
Blog Entries: 2

Rep: Reputation: 6
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, 01:35 PM   #8
captain_sensible
Member
 
Registered: Apr 2010
Posts: 72

Original Poster
Rep: Reputation: 0
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:07 AM
Slackware 10.2 + Mysql + Apache + PHP + Tomcat Black187 Slackware 5 11-16-2005 08:11 AM
Slackware 10.2 + Mysql + Apache + PHP + Tomcat Black187 Linux - General 1 11-16-2005 03:11 AM
apache + php + tomcat berrance Linux - Software 1 08-08-2005 08:33 AM
tomcat with apache +php gigya Linux - Software 2 01-30-2004 11:30 AM


All times are GMT -5. The time now is 05:26 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration