Thursday, 2 August 2012

php tomcat mac jee

How to install tomcat in mac

# Add the wget alias for curl to the end of the bash_profile file
echo 'alias wget="curl -O"' >> ~/.bash_profile
Create a Projects Directory 

mkdir projects
cd projects 

mkdir tomcats
cd tomcats 
Download Apache Tomcat

Unpack tomcat

tar -xzvf apache-tomcat-7.0.29.tar.gz
rm apache-tomcat-7.0.29.tar.gz
I have renamed the apache-tomcat-7.0.29 to tomcat7029 (7029 as the version of the tomcat)
1) Check to see the list of Java VMs in your machine
ls /System/Library/Frameworks/JavaVM.framework/Versions/
I had 1.6 version

2) check if Home dir is present

ls /System/Library/Frameworks/JavaVM.framework/Versions/1.6
open the file in the tomcat/bin folder
Add this line after the one which starts with EXECUTABLE=
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
then starting tomcat 
tomcats > sh tomcat7029/bin/ 

Open a Browser

Type in http://localhost:8080 in the address bar

Tomcat Installed !!!

Now installing PHP

there is a PHP java bridge library and only catch is we have to use Tomcat 6 and Java JDK 1.6 as this inly contains a JSR 223 command line script interpreter called jrunscript.

installation details

First to install php5 and php-cgi (along with all its dependencies!) with:
sudo apt-get install php5 php-cgi