PHP and Tomcat integration-php Tutorial

Source: Internet
Author: User
PHP and Tomcat integrate my software as follows: Apache2.2? Directory: C: ProgramFiles (x86) ApacheSoftwareFoundationApache2.2Tomcat5.5 Directory: D: apache-tomcat-5.5.25PHP Directory: D: DEVphp-5.2.13-Win32-VC6-x86MySqlS PHP and Tomcat integration

My software is as follows:

Apache2.2? Directory: C: \ Program Files (x86) \ Apache Software Foundation \ Apache2.2

Tomcat 5.5 Directory: D: \ apache-tomcat-5.5.25

PHP Directory: D: \ DEV \ php-5.2.13-Win32-VC6-x86

MySql Server5.2 Directory: C: \ Program Files (x86) \ MySQL Server 5.2

JK plug-in: mod_jk-1.2.28-httpd-2.2.3.so

?

You need to make the following settings:

1. when installing Apache2.2, let you select the domain name and port. I wrote www.seya.com, Port: 80. write your own email address: [email protected]. you can change it later.

?

2. Install java JDK and set Tomcat environment variables. you can set CATALINA_HOME and CATALINA_BASE to the tomcat root directory to ensure that the catalina start command can be run in the bin directory under tomcat.

?

3. After MySql Server5.2 is installed, it is configured by default. all the way to Next. set the password of the root account, such as 111111.

?

4. configure the PHP service so that it can provide both the PHP and JSP services.

1. change the php. ini-dist file in the php installation directory to php. ini, and remove the semicolon (uncomment) from the front of the lines)

? Extension = php_mbstring.dll
? Extension = php_dbase.dll
? Extension = php_gd2.dll
? Extension = php_mysql.dll

And change extension_dir = "extension_dir =" D:/DEV/php-5.2.13-Win32-VC6-x86/ext/"The above files are in this directory.

2. configure Apache and modify the C: \ Program Files (x86) \ Apache Software Foundation \ Apache2.2 \ conf \ httpd. conf file.

Modify DocumentRoot "D:/DEV/php-5.2.13-Win32-VC6-x86/webroot /"

Modify

Add several lines under ScriptAlias/cgi-bin/"C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/" to support the PHP service:

??? ScriptAlias ???????????? /Php /? "D:/DEV/php-5.2.13-Win32-VC6-x86 /"
??? Addtype ??????????? Application/x-httpd-php. php
??? Action ????????? Application/x-httpd-php "/php/php.exe"

3. load PHP and JK modules

?? LoadModule php5_module "D:/DEV/php-5.2.13-Win32-VC6-x86/php5apache2_2.dll"
?? AddHandler application/x-httpd-php. php

?? # Configure the path to php. ini
?? PHPIniDir "D:/DEV/php-5.2.13-Win32-VC6-x86"

?? LoadModule jk_module modules/mod_jk-1.2.28-httpd-2.2.3.so

4. configuration and Tomcat integration

? Create the directory ConnApaTom under D: \ DEV \ php-5.2.13-Win32-VC6-x86 and create the file workers. properties under it with the following content:

? Workers. tomcat_home = D: \ apache-tomcat-5.5.25
Workers. java_home = C: \ Program Files (x86) \ Java \ jdk1.5.0 _ 05
Worker. list = ajp12, ajp13
Worker. ajp12.port = 8007
Worker. ajp12.host = localhost
Worker. ajp12.type = ajp12
Worker. ajp12.lbfactor = 1
Worker. ajp13.port = 8009
Worker. ajp13.host = localhost
Worker. ajp13.type = ajp13
Worker. ajp13.lbfactor = 1
Worker. loadbalancer. type = lb
Worker. loadbalancer. balance_workers = ajp12, ajp13
Worker. inprocess. type = jni
Worker. inprocess. class_path = $ (workers. tomcat_home) $ (ps) lib $ (ps) tomcat. jar
Worker. inprocess. worker _line = start
Worker. inprocess. jvm_lib = $ (workers. java_home) $ (ps) jre $ (ps) bin $ (ps) classic $ (ps) jvm. dll
Worker. inprocess. stdout = $ (workers. tomcat_home) $ (ps) logs $ (ps) inprocess. stdout
Worker. inprocess. stderr = $ (workers. tomcat_home) $ (ps) logs $ (ps) inprocess. stderr

?

Then modify the C: \ Program Files (x86) \ Apache Software Foundation \ Apache2.2 \ conf \ httpd. conf file and add the following lines:

JkWorkersFile "D:/DEV/php-5.2.13-Win32-VC6-x86/ConnApaTom/workers. properties"
JkMount/servlet/* ajp13
JkMount/*. jsp ajp13
JkMount/*. do? Ajp13

The. jsp,. do, and/servlet requests are forwarded to the path set in workers. properties for processing, that is, D: \ apache-tomcat-5.5.25. The JSP is integrated into the PHP server.
?

Now the configuration is complete, restart Apache and Tomcat. Put your JSP project, or php project under the D: \ DEV \ php-5.2.13-Win32-VC6-x86 \ webroot Directory, via localhost: 80 port can be accessed.

?

?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.