RedHat linux AS 5.5+Apache2.2+MYSQL5.1.45+PHP5.3.2 配置手记
安装MYSQL
下载各个版本的MYSQL地址:
- # groupadd mysql
- # useradd -g mysql -d /usr/local/mysql/data -M mysql
- # tar -zxvf mysql-5.1.45.tar.gz
- # cd mysql-5.1.45
- ./configure --prefix=/usr/local/mysql \ 指定安装目录
- > --sysconfdir=/usr/local/mysql/etc \ 配置文件的路径
- > --localstatedir=/usr/local/mysql/data \ 数据库存放的路径
- > --enable-assembler \ 允许使用汇编模式(优化性能)
- > --with-client-ldflags=-all-static \ 以纯静态方式编译客户端
- > --with-mysqld-ldflags=-all-static \ 以纯静态方式编译服务端 静态链接提高13%性能
- > --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock 使用unix套接字链接提高7.5%性能
- > --with-charset=utf8 \ 添加utf8字符支持
- > --with-extra-charsets=all 添加所有字符支持
- # make
- # make install
- # /usr/local/mysql/bin/mysql_install_db
- # chown -R mysql:mysql /usr/local/mysql/data
- # cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
- # chkconfig --add mysqld
- # cp /usr/local/mysql/share/mysql/my-medium.cnf /usr/local/mysql/etc/my.cnf
#p#
安装OpenSSL
- # tar -zxvf openssl-1.0.0.tar.gz
- # cd openssl-1.0.0
- # ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
- # make
- # make install
- # vi /etc/ld.so.conf
添加路径
- /usr/local/ssl/lib
更新运行时连接
- # ldconfig
编译和安装 apr
- # tar -zxvf apr-1.4.2.tar.gz
- # cd apr-1.4.2
- # ./configure --prefix=/usr/local/apr
- # make
- # make install
编译和安装 apr-util
- # tar -zxvf apr-util-1.3.9.tar.gz
- # cd apr-util-1.3.9
- # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
- # make
- # make install
#p#
安装Apache
- tar -zvxf httpd-2.2.15.tar.gz
- cd httpd-2.2.15
- # vi server/mpm/worker/worker.c
找到下面几行,并改成如下的数值,其目的是在源码中修改apache可支持的最大线程数和最大客户端数目。
- # define DEFAULT_SERVER_LIMIT 256
- # define MAX_SERVER_LIMIT 40000
- # define DEFAULT_THREAD_LIMIT 256
- # define MAX_THREAD_LIMIT 40000
- ./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all --with-mpm=worker
- --enable-rewrite --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache
- --enable-file-cache --enable-proxy --enable-ssl --with-ssl=/usr/local/ssl –
- --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
- > --enable-dav --enable-dav-fs SVN支持
- make
- make install
先安装支持包(注意安装顺序)
gd-2.0.35.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.4.1.tar.gz
zlib-1.2.4.tar.gz
freetype-2.1.9.tar.gz
libxml2-2.6.30.tar.gz
建立初始目录:
- mkdir /usr/local/modules
jpeg目录
- mkdir /usr/local/modules/jpeg6
- mkdir /usr/local/modules/jpeg6/bin
- mkdir /usr/local/modules/jpeg6/lib
- mkdir /usr/local/modules/jpeg6/include
- mkdir /usr/local/modules/jpeg6/man
- mkdir /usr/local/modules/jpeg6/man/man1
安装libxml
- # tar -zxvf libxml2-2.6.30.tar.gz
- # cd libxml2-2.6.30
- # ./configure (xml默认安装就可以,不要指定路径了,因为安装时php可能找不到它,PHP5只支持libxml2-2.5.10以上版本)
- # make
- # make install
安装zlib
- tar xzvf zlib-1.2.4.tar.gz
- cd zlib-1.2.4
- #不要用--prefix自定义安装目录,影响gd的安装
- ./configure
- make
- make install
安装freetype
- tar xzvf freetype-2.3.12.tar.gz
- cd freetype-2.3.12
- ./configure --prefix=/usr/local/modules/freetype
- make
- make install
安装libpng
- tar xzvf libpng-1.4.1.tar.gz
- #不要用--prefix自定义安装目录,影响gd的安装
- cd libpng-1.4.1
- cp scripts/makefile.std makefile
- make
- make install
安装jpeg
- tar xzvf jpegsrc.v6b.tar.gz
- ./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
- make
- make install
安装GD
- tar xzvf gd-2.0.35.tar.gz
- ./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-zlib --with-freetype=/usr/local/modules/freetype
- make
- make install
安装cURL
- # wget http://curl.haxx.se/download/curl-7.20.1.tar.gz
- # tar -zxvf curl-7.20.1.tar.gz
- # cd curl-7.20.1
- # ./configure --prefix=/usr/local/curl --with-ssl=/usr/local/ssl
- # make
- # make install
- tar -zxvf php-5.3.2.tar.gz
- cd php-5.3.2
- ./configure --prefix=/usr/local/php \
- --with-mysql=mysqlnd \
- --with-mysqli=mysqlnd \
- --with-pdo-mysql=mysqlnd \
- --with-apxs2=/usr/local/apache/bin/apxs \
- --with-libxml-dir=/usr/local/lib \
- --with-gd=/usr/local/modules/gd \
- --with-jpeg-dir=/usr/local/modules/jpeg6 \
- --with-zlib \
- --with-png-dir \
- --with-freetype-dir=/usr/local/modules/freetype \
- --with-xmlrpc \
- --with-iconv
- --enable-soap
- --enable-inline-optimization
- --enable-sockets
- --enable-mbstring
- --enable-static
- --with-openssl=/usr/local/ssl
- --with-curl=/usr/local/curl
- make
- make install
cp ./php.ini-development /usr/local/php/lib/php.ini
修改httpd.conf
- #vi /usr/local/apache/conf/httpd.conf
加载php模块,去掉注释“#”,如没有此行,请加上。
- LoadModule php5_module modules/libphp5.so
加上此两行
- AddType application/x-httpd-php .php .phtml
- AddType application/x-httpd-php-source .phps
【编辑推荐】