LAMP集群项目四 安装apachephp及其插件
Posted panzer
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LAMP集群项目四 安装apachephp及其插件相关的知识,希望对你有一定的参考价值。
rpm -qa httpd* 查看是否有apache
rpm -e httpd-2.2.22.2 卸载该文件,如果不让卸载,则加参数:--nodeps 不做软件中的依赖检查
./configure --prefix=/application/apache/ --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite
make && make install
配置http.conf
修改ServerName
打开 vhosts cd extra/
配置vhost
mkdir /app/logs -p 创建日志文件
rpm -qa zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel
yum install zlib libxml libjepg freetype libpng ge curl libiconv zlib-devle libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel crul-devel -y
安装libiconv库 wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz ibiconv库[1] 为需要做转换的应用提供了一个iconv()的函数,以实现一个字符编码到另一个字符编码的转换。 ./configure --prefix=/usr/local/libiconv make make install
bin/apachectl -t 检查语法
for n in `ls /data0/www `;do echo $n > /data0/www/$n/index.html; done 修改hosts文件C:\\Windows\\System32\\drivers\\etc 192.168.1.27 bbs.etiantian.org blog.etiantian.org www.etiantian.org hao123.etiantian.org status.etiantian.org 采用egrep 来查看 egrep -v "#|^$" httpd.conf <Directory "/application/apache//htdocs"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory>
改为
<Directory "/data0/www"> Options -Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> Index加 - 号,不需要索引
apachectl graceful 平滑重启命令
安装php
http://museum.php.net/php5/ 旧版的php下载地址
安装PHP 使用5.3.8以上
tar xf php-5.5.15.tar.bz2 yum install openssl openssl-devel curl-devel libxslt-devel -y ln -s /usr/lib64/libssl.so /usr/lib/ 编译:需要指定php和mysql的路径 ./configure \\ --prefix=/application/php5.3.15 \\ --with-apxs2=/application/apache/bin/apxs \\ --with-mysql=/usr/local/mysql \\ --with-xmlrpc \\ --with-openssl \\ --with-zlib \\ --with-freetype-dir \\ --with-gd \\ --with-jpeg-dir \\ --with-png-dir \\ --with-iconv=/usr/local/libiconv \\ --enable-short-tags \\ --enable-sockets \\ --enable-zend-multibyte \\ --enable-soap \\ --enable-mbstring \\ --enable-static \\ --enable-gd-native-ttf \\ --with-curl \\ --with-xsl \\ --enable-ftp \\ --with-libxml-dir make && make install ln -s /application/php5.3.15 /application/php 创建链接 复制配置文件: cp php.ini-production /application/php/lib/php.ini 配置apache支持php 在311行 加入 AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps LoadModule php5_module modules/libphp5.so 在65行 将user和group都改为 ett用户 (但是没有找到) useradd ett -M -s /sbin/nologin vi httpd.conf +166 在166行 添加一个首页文件 index.php 然后检查语法: ../bin/apachectl -t ../bin/apachectl graceful
重启apache
http://www.etiantian.org/phpinfo.php
安装php扩展
echo \'export LC_ALL=C\'>> /etc/profile . /etc/profile 安装 eaccelerator-0.9.6.tar.bz2 加速扩展(不兼容高版本的PHP) tar jxf eaccelerator-0.9.6.tar.bz2 /application/php/bin/phpize ./configure --enable-eaccelerator=shared --with-php-config=/application/php/bin/php-config make && make install
安装memcache缓存扩展模块
tar zxf memcache-2.2.5.tgz /application/php/bin/phpize ./configure --with-php-config=/application/php/bin/php-config make && make install
安装PDO_MYSQL扩展模块(非必须)
/application/php/bin/phpize
./configure --with-php-config=/application/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
配置php相关扩展插件模块:
ls -l /application/php/lib/php/extensions/no-debug-zts-20090626/ cat >> /application/php/lib/php.ini<<EOF ;--cache ext start by oldboy 2012-4-18-- extension = memcache.so extension = pdo_mysql.so extension = imagick.so ;--cache ext end by oldboy 2012-4-18-- EOF tail -5 /application/php/lib/php.ini cd /application/php/lib/ cp php.ini php.oldboy.20120418- sed -i \'s#; extension_dir = "./"#extension_dir = "/application/php5.3.15/lib/php/extensions/no-debug-zts-20090626/"#g\' php.ini #注意:路径一定要写对 grep "extension_dir =" php.ini
配置eAccelerator插件
mkdir -p /tmp/eaccelerator chown -R ett.ett /tmp/eaccelerator cat >> /application/php/lib/php.ini<<EOF [eaccelerator] extension=eaccelerator.so eaccelerator.shm_size="64" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="3600" eaccelerator.shm_prune_period="3600" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9" EOF
检查加速情况:
查看缓存目录:
ll /tmp/eaccelerator
配置xcache 加速
echo >>php.ini echo \';xcache config by oldboy 20120418----------------------\' >>php.ini tail -2 php.ini cat /home/oldboy/tools/xcache-1.3.2/xcache.ini >>php.ini
http://www.etiantian.org/phpinfo.php 访问网站查看安装插件的情况
安装wordpress,Discuz ,dedeCMS
mv wordpress/* /data0/www/blog/ mv DedeCMS-V5.7-GBK-SP1-Full/uploads/* /data0/www/www/ unzip Discuz_X2.5_SC_GBK.zip mv upload/* /data0/www/bbs/ 创建数据库 create database www; create database bbs; create database blog; grant select,insert,update,delete,alert,create on www.* to www@\'10.0.0.%\' identified by \'123456\';
以上是关于LAMP集群项目四 安装apachephp及其插件的主要内容,如果未能解决你的问题,请参考以下文章