Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1156775
  • 博文数量: 150
  • 博客积分: 2739
  • 博客等级: 少校
  • 技术积分: 2392
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-07 12:28
文章分类

全部博文(150)

文章存档

2015年(2)

2014年(16)

2013年(10)

2012年(58)

2011年(64)

分类: LINUX

2014-04-21 15:00:33

这个安装是客户指定版本要安装的,其间出现了不了的问题,在主这里写了,算是总结吧!
参考文档:

一、 安装apache 5.2.26,apr,apr-util

1、安装apr和apr-util


点击(此处)折叠或打开

  1. 安装apr
  2. #wget http://mirrors.cnnic.cn/apache//apr/apr-1.5.0.tar.gz
  3. #wget http://mirrors.cnnic.cn/apache//apr/apr-util-1.5.3.tar.gz
  4. #tar xvf apr-1.5.0.tar.gz
  5. #cd apr-1.5.0
  6. #./configure
  7. #make && make install 默认是安装在/usr/local/apr下的

  8. 安装apr-util
  9. #tar xvf apr-util-1.5.3.tar.gz
  10. #cd apr-util-1.5.3
  11. #./configure --with-apr=/usr/local/apr
  12. #make && make install




2、安装httpd

点击(此处)折叠或打开

  1. #wget http://apache.fayea.com/apache-mirror//httpd/httpd-2.2.26.tar.gz
  2. #tar xvf httpd-2.2.26.tar.gz
  3. #cd httpd-2.2.26
  4.   #./configure --prefix=/opt/apache-5.2.26 --enable-cgi --enable-rewrite --enable-ssl --enable-so --enable-so -enable-mods-shared=all --enable-modules=all
  5. 如果采用apache中apr
  6. # ./configure --prefix=/opt/apache-5.2.26 --enable-cgi --enable-rewrite --enable-ssl --enable-so --enable-so -enable-mods-shared=all --enable-modules=all --with-included-apr=/usr/local/apr
  7. #make
  8. #make install
  9. #/opt/apache/bin/apachectl restart




二、安装mysql


点击(此处)折叠或打开

  1. 首先要确定是否安装了cmake,mysql5.5以上版本是要用Cmake安装的。
  2. #groupadd mysql
  3. #useradd -g mysql mysql -s /sbin/nologin
  4. #wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.36.tar.gz
  5. #tar xvf mysql-5.5.36.tar.gz
  6. #cd mysql-5.5.36
  7. #cmake .\
  8. -DCMAKE_INSTALL_PREFIX=/opt/svr/mysql \
  9. -DMYSQL_UNIX_ADDR=/opt/mysql/mysql.sock \
  10. -DDEFAULT_CHARSET=utf8 \
  11. -DDEFAULT_COLLATION=utf8_general_ci \
  12. -DWITH_MYISAM_STORAGE_ENGINE=1 \
  13. -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  14. -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \
  15. -DENABLED_LOCAL_INFILE=1 \
  16. -DMYSQL_DATADIR=/opt/mysql/data \
  17. -DMYSQL_USER=mysql \
  18. -DMYSQL_TCP_PORT=3306
  19. #make
  20. #make install

  21. 提示:如果编译安装中出现了什么错误时,要用清除旧的文件
  22. #make clean
  23. #rm -rm CMakeCache.txt

  24. 设置目录权限和相应的配置文件:
  25. #chown -R root:mysql /opt/mysql
  26. #chow -R mysql:mysql /opt/mysql/data
  27. #cp support-files/mysql.server /etc/init.d/mysqld
  28. #chmod +x /etc/init.d/mysqld
  29. #cp support-files/my-medium.cnf /etc/my.cnf

  30. 初始化数据库:
  31. #./scripts/mysql_install_db --basedir=/opt/mysql/ --datadir=/opt/mysql/data/ --user=mysql

  32. 启动数据库:
  33. service mysqld start



三、安装php


点击(此处)折叠或打开

  1. #wget http://museum.php.net/php5/php-5.2.11.tar.bz2
  2. #tar xvf php-5.2.11.tar.bz2
  3. #cd php-5.2.11
  4. #./configure --prefix=/opt/php --enable-fastcgi --with-config-file-path=/etc/ --disable-ipv6 --with-openssl --with-bz2 --with-curl --with-mysql=/opt/mysql --with-apxs2=/opt/apache/bin/apxs --with-config-file-path=/opt/php/etc/ --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-jpeg-dir=/usr/ --with-png-dir=/usr/ --with-zlib --with-freetype-dir=/usr/ --enable-mbstring --enable-sockets --enable-ftp --with-libxml-dir=/usr

  5. #make
  6. #make install
  7. #cp php.ini-dist /opt/php/etc/php.ini
  8. 问题:
  9. chmod 755 /usr/local/apache2/modules/libphp5.so
  10. chmod: cannot access `/usr/local/apache2/modules/libphp5.so': No such file or directory
  11. apxs:Error: Command failed with rc=65536

  12. 安装这个的时候好生坑爹总是出现这个问题,php-5.2.14.tar.gz,php-5.2.17.tar.bz2出现此类问题,之后更换php-5.2.11.tar.bz2即可解决。
  13. 而使用php-5.2.10.tar.bz2出现以下问题
  14. /usr/local/src/php-5.2.6/ext/openssl/openssl.c:2615: error:
  15. 'struct php_x509_request' has no member named 'priv_key_encrypt'
  16. make: *** [ext/openssl/openssl.lo] Error 1
  17. 这个问题网上说#make ZEND_EXTRA_LIBS='-liconv




四、整合php和和apache


点击(此处)折叠或打开

  1. 1、编辑/opt/apache/conf/httpd.conf文件,加入以下内容
  2.     AddType application/x-httpd-php .php
  3.     AddType application/x-httpd-php-source .phps
  4.    
  5. <IfModule dir_module>
  6.     DirectoryIndex index.php index.html
  7. </IfModule>

  8. 2、在htdocs文件下创建test.php
  9. <?php
  10.   phpinfo();
  11. ?>

  12. 3、重新启动apache服务
  13. /opt/apache/bin/apachectl restart

  14. 4、通过http://URL/test.php访问是否能看到php信息,看到就是成功



五、安装memcached和memcache


1、安装memcached服务:


点击(此处)折叠或打开

  1. 安装libevent:

  2. #wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
  3. #tar xvf libevent-2.0.21-stable
  4. #./configure --prefix=/opt/libevent
  5. #make && make install

  6. 安装memcached服务:

  7. #wget https://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
  8. #tar xvf memcached-1.4.15.tar.gz
  9. #cd memcached-1.4.15
  10. #./configure --prefix=/opt/memcached --with-libevent=/opt/libevent/
  11. 如果采用的是yum安装libevent,libevent-devle
  12. #./configure --prefix=/opt/memcached --with-libevent
  13. #make
  14. #make install

  15. 启动memcached服务:
  16. /opt/memcached/bin/memcached -d -u root -m 1024 -p 11211 -P /tmp/memcached.PID



2、安装libmemcached


点击(此处)折叠或打开

  1. #wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
  2. #./configure --prefix=/opt/libmemcached --with-memcached=/opt/memcached --with-mysql=/opt/mysql/bin/mysql_config
  3. #make
  4. #make install


3、安装memcache

点击(此处)折叠或打开

  1. tar xvf memcache-2.2.7.tgz
  2. cd memcache-2.2.7
  3. /opt/php/bin/phpize
  4.  ./configure --prefix=/opt/memache --with-php-config=/opt/php/bin/php-config --enable-memcache --with-zlib-dir
  5. make
  6. make test
  7. make install
  8. ls /opt/php/lib/php/extensions/no-debug-non-zts-20060613/ 是否有memcache.so文件
  9. 编辑vim /opt/php/etc/php.ini加入
  10. 把extension_dir="/"改成extension_dir = "/opt/php/lib/php/extensions/no-debug-non-zts-20060613/"
  11. extension=memcache.so

  12. 重新启动apache服务:
  13. /opt/apache/bin/apachectl restart

  14. 重新启动memcached服务:
  15. kill -9 /tmp/memcached.PID
  16. /opt/memcache/bin/memcached -d -u root -m 1024 -p 11211 -P /tmp/memcache.PID

  17. 测试一下:
  18. 在apache目录下创建一个文件memcache.php测试文件并通过http://URL/b.php访问,看结果是否正常工作:
  19. <?php
  20. $mem = new Memcache;
  21. $mem->connect("127.0.0.1", 11211);
  22. $mem->set('key','This is OK....', 0, 60);
  23. $val = $mem->get('key');
  24. echo $val;
  25. ?>



六、php添加mysql模块:


点击(此处)折叠或打开

  1. 通过/opt/php/bin/php -m查看已经安装的模块或通过test.php文件找看是否安装了相应的模块
  2. 进入到解压的源码包中,进行相应的操作:
  3. #/root/soft/php-5.2.11/ext/mysql
  4. #/opt/php/bin/phpize
  5. #./configure --with-mysql=/opt/mysql
  6. #make
  7. #make install
  8. 编辑php.ini文件把mysql.so模块启用就行了。

七、安装php加速器eaccelerator


点击(此处)折叠或打开

  1. mkdir -pv /opt/php/cache
  2. chmod 775 /opt/php/cache/ -R
  3. wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
  4. tar xvf libmemcached-1.0.18.tar.gz
  5. cd libmemcached-1.0.18
  6. /opt/php/bin/phpize
  7.  ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
  8. ./configure --enable-eaccelerator=shared --with-php-config=/opt/php/bin/php-config
  9. make
  10. make install

  11. [eaccelerator]
  12. extension="/opt/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
  13. eaccelerator.shm_size="1024"
  14. eaccelerator.cache_dir="/opt/php/cache/eaccelerator"
  15. eaccelerator.enable="1"
  16. eaccelerator.optimizer="1"
  17. eaccelerator.check_mtime="1"
  18. eaccelerator.debug="0"
  19. eaccelerator.filter=""
  20. eaccelerator.shm_max="0"
  21. eaccelerator.shm_ttl="0"
  22. eaccelerator.shm_prune_period="0"
  23. eaccelerator.shm_only="0"
  24. eaccelerator.compress="1"
  25. eaccelerator.compress_level="9"




好了,配置结束。。。。。

阅读(2086) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~