apache+php+tomcat+mysql整合 系统软件环境: Linux 2.6.9-89.ELsmp apr-1.1.1.tar.tar apr-util-1.1.2.tar.tar httpd-2.2.6.tar.tar jakarta-tomcat-connectors-jk2-src-current.tar.tar jakarta-tomcat-5.0.30.tar.gz jdk-1_5_0_11-linux-i586-rpm.bin mysql-5.0.20a php-5.2.5 强烈建议停掉系统默认自带的mysql [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-lvroot 3.9G 3.2G 527M 86% / /dev/sda1 99M 14M 81M 15% /boot none 147M 0 147M 0% /dev/shm /dev/mapper/vg00-lvapp 4.8G 42M 4.5G 1% /webapp 一 、安装步骤 1、安装mysql-5.0.20a [root@jieli software]# pwd /webapp/software [root@jieli software]# tar -zxvf mysql5.0.tar.gz ./mysql-5.0.20a/cmd-line-utils/libedit/hist.h ./mysql-5.0.20a/cmd-line-utils/libedit/refresh.c ./mysql-5.0.20a/cmd-line-utils/libedit/tokenizer.c [root@jieli software]# cd mysql-5.0.20a/ [root@jieli mysql-5.0.20a]# ./configure --prefix=/webapp/db/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --with--charset=gbk --with-extra-charsets="gbk gb2312 big5 utf8" --with-unix-socket-path=/etc/mysql.sock Remember to check the platform specific part of the reference manual for hints about installing MySQL on your platform. Also have a look at the files in the Docs directory.
Thank you for choosing MySQL!
[root@jieli mysql-5.0.20a]# make make[3]: Leaving directory `/webapp/software/mysql-5.0.20a/server-tools' make[2]: Leaving directory `/webapp/software/mysql-5.0.20a/server-tools' make[1]: Leaving directory `/webapp/software/mysql-5.0.20a' [root@jieli mysql-5.0.20a]# make install make[4]: Leaving directory `/webapp/software/mysql-5.0.20a/server-tools' make[3]: Leaving directory `/webapp/software/mysql-5.0.20a/server-tools' make[2]: Leaving directory `/webapp/software/mysql-5.0.20a/server-tools' make[1]: Leaving directory `/webapp/software/mysql-5.0.20a' [root@jieli mysql]# cd /webapp/db/mysql/bin/ [root@jieli bin]# ./mysql_install_db ------必须执行这个来生成基本数据库 Installing all prepared tables Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /webapp/db/mysql/bin/mysqladmin -u root password 'new-password' /webapp/db/mysql/bin/mysqladmin -u root -h jieli password 'new-password' See the manual for more instructions.
You can start the MySQL daemon with: cd /webapp/db/mysql ; /webapp/db/mysql/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory: cd sql-bench ; perl run-all-tests
Please report any problems with the /webapp/db/mysql/bin/mysqlbug script!
The latest information about MySQL is available on the web at
Support MySQL by buying support/licenses at [root@jieli bin]# ./mysqld_safe --user=root & [1] 29019 [root@jieli bin]# Starting mysqld daemon with databases from /var/lib/mysql
[root@jieli etc]# pwd /etc [root@jieli etc]# vi ld.so.conf include ld.so.conf.d/*.conf /webapp/db/mysql/lib/mysql/ ----添加这一行,把mysql的动态库的路径加入到系统中,其他的程序就可以使用mysql的动态库 [root@jieli etc]# ldconfig [root@jieli etc]# cd /webapp/db/mysql/share/mysql/ [root@jieli mysql]# cp my-medium.cnf /etc/my.cnf 设置mysqld开机自启动 [root@jieli mysql]# pwd /webapp/db/mysql/share/mysql [root@jieli mysql]# cp mysql.server /etc/init.d/mysqld [root@jieli mysql]# chkconfig --add mysqld [root@jieli mysql]# chkconfig --level 2345 mysqld on 查看mysql的字符集 mysql> show character set; +----------+-----------------------------+---------------------+--------+ | Charset | Description | Default collation | Maxlen | +----------+-----------------------------+---------------------+--------+ | big5 | Big5 Traditional Chinese | big5_chinese_ci | 2 | | dec8 | DEC West European | dec8_swedish_ci | 1 | | cp850 | DOS West European | cp850_general_ci | 1 | | hp8 | HP West European | hp8_english_ci | 1 | | koi8r | KOI8-R Relcom Russian | koi8r_general_ci | 1 | | latin1 | cp1252 West European | latin1_swedish_ci | 1 | | latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 | | swe7 | 7bit Swedish | swe7_swedish_ci | 1 | | ascii | US ASCII | ascii_general_ci | 1 | | hebrew | ISO 8859-8 Hebrew | hebrew_general_ci | 1 | | koi8u | KOI8-U Ukrainian | koi8u_general_ci | 1 | | gb2312 | GB2312 Simplified Chinese | gb2312_chinese_ci | 2 | | greek | ISO 8859-7 Greek | greek_general_ci | 1 | | cp1250 | Windows Central European | cp1250_general_ci | 1 | | gbk | GBK Simplified Chinese | gbk_chinese_ci | 2 | | latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 | | armscii8 | ARMSCII-8 Armenian | armscii8_general_ci | 1 | | utf8 | UTF-8 Unicode | utf8_general_ci | 3 | | cp866 | DOS Russian | cp866_general_ci | 1 | | keybcs2 | DOS Kamenicky Czech-Slovak | keybcs2_general_ci | 1 | | macce | Mac Central European | macce_general_ci | 1 | | macroman | Mac West European | macroman_general_ci | 1 | | cp852 | DOS Central European | cp852_general_ci | 1 | | latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 | | cp1251 | Windows Cyrillic | cp1251_general_ci | 1 | | cp1256 | Windows Arabic | cp1256_general_ci | 1 | | cp1257 | Windows Baltic | cp1257_general_ci | 1 | | binary | Binary pseudo charset | binary | 1 | | geostd8 | GEOSTD8 Georgian | geostd8_general_ci | 1 | +----------+-----------------------------+---------------------+--------+ 29 rows in set (0.00 sec)
2、安装jdk-1_5_0_11 [root@jieli software]# chmod +x jdk-1_5_0_11-linux-i586-rpm.bin 。。。。。。。。 [root@jieli software]# ./jdk-1_5_0_11-linux-i586-rpm.bin Do you agree to the above license terms? [yes or no] yes 。。。。。。。。 UnZipSFX 5.42 of 14 January 2001, by Info-ZIP (). inflating: jdk-1_5_0_11-linux-i586.rpm Preparing... ########################################### [100%] 1:jdk ########################################### [100%]
+--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+
[root@jieli php-5.2.5]# make install pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0) [PEAR] PEAR - installed: 1.6.1 Wrote PEAR system config file at: /webapp/www/php/etc/pear.conf You may want to add: /webapp/www/php/lib/php to your php.ini include_path Installing PDO headers: /webapp/www/php/include/php/ext/pdo/ [root@jieli php-5.2.5]# cp php.ini-dist /webapp/www/php/php.ini [root@jieli php]# cp php.ini php.ini-bak [root@jieli php]# vi php.ini ; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. mysql.default_socket =/tmp/mysql.sock mysql.sock =/tmp/mysql.sock 。。。。 ; to possible security problems, if the code is not very well thought of. register_globals = On ---修改成On,默认是off,否则会出现php不能直接读到post或get的数据的现象
10、配置,整合apache,tomcat [root@jieli conf]# vi httpd.conf 第一块 DocumentRoot "/webapp/www/apache/htdocs"
# # Each directory to which Apache has access can be configured with respect # to which services and features are allowed and/or disabled in that # directory (and its subdirectories). # # First, we configure the "default" to be a very restrictive set of # features. # Options FollowSymLinks AllowOverride None Order deny,allow Allow from all ----这里默认的deny改成Allow
第二块 Options Indexes FollowSymLinks
# # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None
# # Controls who can get stuff from this server. # Order allow,deny Allow from all XBitHack on ----这里增加一条这个