网站地图    收藏   

主页 > 系统 > apache教程 >

Apache+php+mysql+tomcat整合方法|the-Apache教程

来源:自学PHP网    时间:2014-10-14 00:06 作者: 阅读:

[导读] ...

环境:
Windows XP sp2
jdk1.5

安装文件:
apache2.0.55
PHP-4.4.2-Win32(noinstall)
mysql-noinstall-5.0.18
tomcat5.0.25
jakarta-tomcat-connectors-jk2.0.4-win32-apache2.0.49(mod_jk2.so)

步骤(如何配置tomcat和mysql等略):
1.安装apache2.0.55 (c:/apache)
2.解压php-4.4.2-win32.zip (c:/php)
3.解压mysql-noinstall-5.0.18.zip (c:/mysql)
4.解压tomcat (c:/comcat)
5.拷贝mod_jk2.so到 c:/apache/moudle/
6.拷贝c:/php下的php.ini-dist到c:/windows系统目录下,并改名php.ini
7.打开c:/apache/conf/httpd.conf
添加
LoadModule jk2_module modules/mod_jk2.so

ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php3 .php .phtml
Action application/x-httpd-php "/php/php.exe"

修改
DirectoryIndex index.html index.jsp index.php

去掉以下注释,并修改
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot c:/tomcat/webapphotoshop/ target=_blank class=infotextkey>ps/mySite
    ServerName localhost
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

tomcat/conf/server.xml:
<Context path="" docBase="mySite" debug="0" reloadable="true" crossContext="true"></Context>

8.在c:/apache/conf下新增一文件 workers2.properties:

# Usually commented out on production environments
[logger.apache2]
file=”c:/apache/logs/error.log”
level=ERROR
# Provide the basic config needed
[config]
file=c:/apache/conf/workers2.properties
debug=1
# Provide the location of shm file on the Apache web server
[shm]
file=c:/apache/conf/jk2.shm
size=1048576

[channel.socket:localhost:8009]
port=8009
host=localhost
#define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Map the Tomcat examples webapp to the Web server uri space
#[uri:/*]
[uri:/*.jsp]
worker=ajp13:localhost:8009
[uri:/servlet/*]
worker=ajp13:localhost:8009
[uri:/*.do]
worker=ajp13:localhost:8009

9.去掉c:/tomcat/conf/jk2.properties前面的注释(经过试验不改也能通过):

handler.list=apr,request,channelJni
channelSocket.port=8019
shm.file=c:/apache/conf/jk2.shm
channelJni.disabled = 0
apr.jniModeSo=c:/apache/modules/mod_jk2.so
apr.jniModeSo=inprocess

10.建一目录 c:/phpTest ,打开c:/apache/conf/httpd.conf,添加

Alias /luntan "C:/phpTest/"

<Directory "C:/phpTest">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

11.新建一文件c:/phpTest/test.php,内容为: <? phpinfo(); ?>

12.启动tomcat和apache,可浏览
http://localhost/phpTest/test.php
http://localhost/ == http://localhost:8080/

ok!

另:
安装Discuz!论坛时连接mysql数据库如遇到"... Client does not support authentication protocol" 问题,
原因:MySQL 5.0 uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older (pre-4.1) clients. If you upgrade the server from 4.1, attempts to connect to it with an older client may fail with the following message:
解决方法:
mysql> SET PASSWORD FOR
    -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
    -> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;

"Apache+php+mysql+tomcat整合方法"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Server/Apache/18088.html

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论