apache+php+jsp+mysql+phpmyadmin全攻略
cooc
|
1#
cooc 发表于 2005-06-22 00:25
apache+php+jsp+mysql+phpmyadmin全攻略
转:所需软件列表:(本配置以下列软件版本完成)
jakarta-tomcat-5.0.29.exe apache_2.0.52-win32-x86-no_ssl.exe php-5.0.2-Win32.zip mysql-4.0.22-win.zip j2sdk1.4.1.exe mod_jk_1.2.6_2.0.50.dll mm.mysql-2.0.4-bin.jar phpMyAdmin-2.6.0-pl2.zip 开始安装: 一、 Apahce+PHP+MySQL安装配置 1. 安装apache_2.0.52-win32-x86-no_ssl ,根据需要按提示设置程序安装路径(我的路径是d:/usr/)。安装完成以后,如果对APACHE目录进行移动,那么apache2下面的参数是必须改的, 修改apache配置目录CONF下的配置文件httpd.conf,本例为d:/usr/apache2/conf/httpd.conf (1)ServerRoot:apche的程序目录(本例是d:/usr/apache2) (2)ServerAdmin:服务器管理员的E-MAIL (3)port:服务端口,默认80 (4)ServerName:计算机的网络标识,必须和实际一致,否则可能会出现一些想不到的问题 (5)DocumentRoot:默认的网页文件目录(本例是d:/usr/www) (6)DirectoryIndex:默认页面,添加 php支持,(本例如下) DirectoryIndex index.html index.htm index.php index.php3 index.php4 (7)ScriptAlias(脚本别名),CGI程序的目录 ScriptAlias /cgi-bin “d:/usr/apache2/cgi-bin” 2. 安装php-5.0.2-Win32解压,解压的路径自定义(本例为d:/usr/php5)。 3. 配置PHP和Apache,使之能解析php程序。 PHP配置: 将PHP目录中的“php.ini-dist”改名“php.ini”,并对 php.ini修改如下: (1) doc_root:和APACHE的HTDOCS一致,本例为d:/usr/www (2) extension_dir 本例为 d:/usr/php5/ext (3) include_path 本例为d:/usr/php5/includes (4) 去掉extension=php_mysql.dll前边的分号,并拷贝php目录下的LIBMYSQL.DLL文件到c:\winnt\system32下 Apache配置: 在APACHE配置文件最后添加以下语句,用以支持php程序: ADDlanguage zh-cn .cn defaultlanguage zh-cn AddDefaultCharset GB2312 ScriptAlias /php/ "d:/usr/php5/" LoadFile d:/usr/php5/php5ts.dll LoadModule php5_module d:/usr/php5/php5apache2.dll PHPINIDir d:/usr/php5/php.ini AddType application/x-httpd-php .php .php3 .php4 .phtml AddType application/x-httpd-php-source .phps 以上添加内容目录部分和实际不一致的自行修改 4.重新启动Apache服务器,用编辑器编写如下语句: <? phpinfo(); ?> 保存文件名为“test.php”到用户主目录(本例为d:/usr/www)目录,然后打开浏览器,浏览:http://localhost/test.php,出现PHP基本信息就说明配置成功。 5. 安装MySQL-4.0.12-win,一直按”next”就安装成功了,然后在C:\mysql\bin目录执行” winmysqladmin.exe”,出现mysql的初始信息面,表示安装成功。 6、安装phpMyAdmin 解压phpMyAdmin-2.6.0-pl2.zip到一目录,本例为d:/usr/phpMyAdmin,进入该目录配置文件config.inc.php 修改$cfg['PmaAbsoluteUri']为http://localhost/phpMyAdmin 修改$cfg['blowfish_secret'] = 'admin'; 修改$cfg['Servers'][$i]['auth_type']= 'cookie'; 修改$cfg['Servers'][$i]['user']为MySQL用户 修改$cfg['Servers'][$i]['password']为MySQL口令 以上是phpMyAdmin配置的基本内容,其他配置根据需要进行 编辑apache配置文件httpd.conf在最后加入以下语句: php_admin_flag engine on php_admin_flag safe_mode off Alias /phpMyAdmin "d:/usr/phpMyAdmin" <Directory "d:/usr/phpMyAdmin"> DirectoryIndex index.php Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all php_admin_flag engine on php_admin_flag safe_mode off php_admin_value open_basedir none php_admin_value open_basedir "d:/usr/phpMyAdmin" </Directory> 以上目录路径部分根据实际需要进行修改。 7、测试apache+php+mysql 在ie地址栏输入http://localhost/phpMyAdmin如果出现phpMyAdmin信息说明配置成功。 二、安装JDK和Tomcat 1. 安装j2sdk1.4.1后安装jakarta-tomcat-5.0.29.exe,JDK安装一定要在tomcat之前进行。本例安装路径为d:/usr/ 2. 复制mm.mysql-2.0.4-bin.jar文件分别到j2sdk子目录lib 和 Tomcat 子目录common\lib 下,复制mod_jk_1.2.6_2.0.50.dll 到apache子目录moudles下 3、配置APACHE+tomcat+jsp (1)在apache配置文件后添加 loadModule jk_module modules/mod_jk_1.2.6_2.0.50.dll JkWorkersFile "d:/usr/Tomcat 5.0/conf/workers.properties" JkMount /servlet/* ajp13 JkMount /*.jsp ajp13 (2)新建 d:/usr/Tomcat 5.0/conf/workers.properties内容如下: workers.properties workers.CATALINA_HOME =d:\usr\Tomcat 5.0 workers.JAVA_HOME=d:\usr\j2sdk1.4 ps=\ # worker.list=ajp13 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.balanced_workers=ajp12, ajp13 worker.inprocess.type=jni worker.inprocess.class_path=$(workers.CATALINA_HOME )$(ps)classes worker.inprocess.class_path=$(workers.CATALINA_HOME )$(ps)lib$(ps)jaxp.jar worker.inprocess.class_path=$(workers.CATALINA_HOME )$(ps)lib$(ps)parser.jar worker.inprocess.class_path=$(workers.CATALINA_HOME )$(ps)common$(ps)lib$(ps)jasper.jar worker.inprocess.class_path=$(workers.CATALINA_HOME )$(ps)common$(ps)lib$(ps)servlet.jar worker.inprocess.class_path=$(workers.CATALINA_HOME )$(ps)common$(ps)lib$(ps)webserver.jar worker.inprocess.class_path=$(workers.JAVA_HOME)$(ps)lib$(ps)tools.jar worker.inprocess.cmd_line=-config worker.inprocess.cmd_line=$(workers.CATALINA_HOME )/conf/jni_server.xml worker.inprocess.cmd_line=-home worker.inprocess.cmd_line=$(workers.CATALINA_HOME ) worker.inprocess.jvm_lib=$(workers.JAVA_HOME)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll worker.inprocess.stdout=$(workers.CATALINA_HOME )$(ps)inprocess.stdout worker.inprocess.stderr=$(workers.CATALINA_HOME )$(ps)inprocess.stderr worker.inprocess.sysprops=tomcat.home=$(workers.CATALINA_HOME ) (3)设置环境变量(桌面->我的电脑->右键点击->选择“属性”->高级->环境变量->系统变量)内容如下 JAVA_HOME (变量名)d:\usr\j2sdk1.4 (变量值) PATH(变量名).;%JAVA_HOME\bin;(变量值) CATALINA_HOME (变量名)d:\usr\tomcat 5.0(变量值) CATALINA_BASE(变量名)d:\usr\tomcat 5.0(变量值) CALSSPATH (变量名) .;%JAVA_HOME%libdt.jar;%JAVA_HOME%libtools.jar;%CATALINA_HOME%commonlibservlet.jar(变量值) (5) 编辑 tomcat \conf下的server.xml文件,添加如下内容 <Host name="127.0.0.1" debug="0" appBase="d:\usr\www" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="/" debug="1" /> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="home_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> </Host> <Host name="yxmwxl.vicp.net" debug="0" appBase="d:\usr\www" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="/" debug="1" /> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="home_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> </Host> 到此配置全部结束 |