豆包ko 发表于 2018-11-27 07:13:43

MYSQL+APACHE+PHP (动态安装apache实验中)

系统 :LINUX5.4
目的: MYSQL+APACHE+PHP 实验
软件: mysql-5.1.47.tar.gz
       httpd-2.2.15.tar.gz
       php-5.2.13.tar.gz

一、安装MYSQL
1、    创建mysql用户和组
#chmod777mysql-5.1.47.tar.gz
tar –zxvf mysql-5.1.47.tar.gz
#cd mysql-5.1.47
#groupadd mysql
#useradd –g mysql –s /sbin/nologin mysql


2、开始安装mysql
#./configure
--prefix=/usr/local/mysql         #mysql安装目录
--with-charset=utf8               #使用UTF8字符集
--with-collation=utf8_general_ci#校对规则
--with-extra-charsets=complex   #支持所有的扩展字符集
--with-big-tables               #启用大表
--with-plugins=partition          #大表分割
--enable-thread-safe-client       #让客户端支持线程
--enable-assembler                #允许汇编模式,(优化性能)
--enable-local-infile             #支持从本地导入mysql
--with-mysqld-ldflags=-all-static
--with-client-ldflags=-all-static
# 以纯静态方式编译服务端和客户端   ( 优化性能)
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
#使用unix套接字链接提高 7.5%性能,所以在windows下mysql性能肯定不如unix下面
#make
#make install
#
cp support-files/my-large.cnf /etc/my.cnf

# cd /usr/local/mysql/
#bin/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql var
#chgrp -R mysql .
# bin/mysqld_safe --user=mysql &
1740
# 100610 21:22:15 mysqld_safe Logging to '/usr/local/mysql/var/mysql51.com.err'.
100610 21:22:16 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

3、开机启动mysql
# cp share/mysql/mysql.server /etc/init.d/mysqld
# chkconfig --add mysqld
#cd /etc/init.d/
# chmod +x mysqld
# chkconfig --list mysqld
# chkconfig --level 35 mysqld on
# service mysqld start
Starting MySQL                                             [确定]
# cp /usr/local/mysql/bin/* /sbin/
# mysqladmin -u root -h localhost password 'mysql'
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>show databases;

mysql> grant all privileges on *.* to root@'%' identified by 'aa123456' with grant option;
Query OK, 0 rows affected (0.00 sec)
从你的NVCAT链接试试吧
到这里基本上已经安装成功了

二、安装APR
tar -xvfz apr-1.2.7.tar.gz
cd apr-1.2.7
# ./configure --prefix=/usr/local/apr-apache
# make
# make install

# tar -zxvf apr-util-1.2.7.tar.gz
# cd apr-util-1.2.7
# ./configure --prefix=/usr/local/apr-util-apache --with-apr=/usr/local/apr-apache/
# make
# make install

三、安装APACHE

#chmod777httpd-2.2.15.tar.gz
# cd httpd-2.2.15
# ./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-so --enable-mods-shared=all --enable-moduls=most --enable-rewrite --enable-heades --disable-status --enable-dav --enable-dav-fs --enable-dav-lock --with-apr=/usr/local/apr-apache/ --with-apr-util=/usr/local/apr-util-apache/

*********************************************
--prefix=/usr/local/apache2   #指定安装目录
--with-mpm=worker                  #使用worker 多处理器模块加入核心
--enable-so                                 #动态加载模块(DSO)支持到httpd二进制文件,有了DSO支持,升级和增加模块时只需编译相关模块即可,不必重新编译整个系统。
--enable-mods-shared=all       #以DSO方式编译全部的模块
--enable-module=most   
--enable-rewrite                     #一个基于一定规则的实时重写URL 请求的引擎
--enable-headers         #允许通过配置文件控制任意的HTTP 请求和应答头信息
--disable-status                            #禁用服务器状态
--enable-dav --enable-dav-fs --enable-dav-lock#加载webdav模块
--with-apr=/usr/local/apr-apache/ --with-apr-util=/usr/local/apr-util-apache/                                                #指定apr路径

***********************************************

2.2.15]#make
2.2.15]#make install

开机自启动
# echo "/usr/local/apache2/bin/apachectl start" >> rc.local

四、安装PHP
1、安装Php
# tar -xvzf php-5.2.13.tar.gz
# cd php-5.2.13
# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/ --enable-soap --with-gd --enable-sockets --enable-mbstring --disable-ipv6 --enable-exif --with-zlib --with-curl -with-curlwrappers --enable-calendar --with-gettext --enable-gd-native-ttf --enable-zend-multibyte --with-bz2--with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-libxml-dir
****************************************************
--prefix=/usr/local/php5                     \\指定 php 安装目录
--with-apxs2=/usr/local/apache2/bin/apxs    \\整合 apache,apxs功能是使用mod_so中的 LoadModule指令,加载指定模块到pache,要求 apache 要打开SO模块
--with-MySQL=/usr/local/mysql            \\mysql安装目录,对mysql的支持
--with-mysqli=/usr/local/mysql/bin/mysql_config   \\mysqli扩展技术不仅可以调用MySQL的存储过程、处理MySQL事务,而且还可以使访问数据库工作变得更加稳定。
--with-pdo-mysql=/usr/local/mysql#同样MSYQL支持
--enable-soap                   \\启用SOAP支持
--with-gd                           \\打开gd库的支持
--enable-sockets            \\打开 sockets 支持
--enable-mbstring             \\多字节,字符串的支持
--disable-ipv6                  \\关闭IPV6支持
--with-zlib                           \\打开zlib库的支持
--enable-exif                      \\图片的元数据支持
--with-curl                           \\打开curl浏览工具的支持
--with-curlwrappers            \\运用curl工具打开url流
--enable-calendar               \\打开日历扩展功能
--with-gettext                      \\打开gnu 的gettext 支持,编码库用到
--enable-gd-native-ttf         \\支持TrueType字符串函数库
--enable-zend-multibyte      \\支持zend的多字节
--with-bz2                           \\打开对bz2文件的支持
--with-jpeg-dir                      \\打开对jpeg图片的支持
--with-png-dir                     \\打开对png图片的支持
--with-freetype-dir               \\打开对freetype字体库的支持
--with-iconv-dir
--with-libxml-dir                     \\打开libxml2库的支持

**********************************************************
#make
]#make test
#make install
#cp php.ini-dist /usr/local/php5/lib/php.ini
#vi /usr/local/apache2/conf/httpd.conf
注意一下 105 行
LoadModule php5_module      modules/libphp5.so
在360行   AddType application/x-gzip .gz .tgz后添加   
   AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps

找到Directory index 后面添加 index.php

2、重启apache
5.2.3]cd /usr/local/apache2/htdocs/
#
touch index.php


终于安装完毕,总的来说,是安装APACHE+MYSQL+PHP最完整的一次了,哪里不足之处请多多指教。LAMP常用的一些参数
apache:
--enable-headers --enable-deflate:使用apache的压缩模块mod_deflate.so
提高网站的访问速度



页: [1]
查看完整版本: MYSQL+APACHE+PHP (动态安装apache实验中)