工作,学习,生活,这里将会有一些记录. 备用域名:http://meisw.wdlinux.cn 注册 | 登陆
浏览模式: 标准 | 列表分类:apache/web

Zend 在x86_64位的问题

php-5.2.13/sbin/php-fpm restart
Shutting down php_fpm  done 

Starting php_fpm Failed loading /usr/local/Zend/lib/ZendExtensionManager.so: 

/usr/local/Zend/lib/ZendExtensionManager.so: wrong ELF class: ELFCLASS32 done 

 

安装X86_64版

apache22 mod_expires

./configure \
--prefix=/www/servers/httpd22 \
--with-mpm=worker \
--enable-rewrite \
--enable-speling \
--enable-so \
--disable-status \
--disable-filter \
--disable-version \
--disable-cgid \
--disable-cgi \
--disable-actions \
--disable-userdir \
--enable-expires \
--enable-headers \
--disable-autoindex \
--disable-authn-file \
--disable-authz-user \
--disable-authz-groupfile \
--disable-authz-default


  --disable-authn-default authentication backstopper
  --disable-authz-host    host-based authorization control
  --disable-auth-basic    basic authentication


<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/gif "access plus 300 minutes"
    ExpiresByType image/jpeg "access plus 300 minutes"
    ExpiresByType image/png "access plus 300 minutes"
    ExpiresByType text/css "access plus 300 minutes"
    ExpiresByType application/x-shockwave-flash "access plus 300 minutes"
    #ExpiresByType application/x-shockwave-flash "access plus 300 minutes"
    ExpiresDefault "now plus 1 day"
</IfModule>


http://hi.baidu.com/zjw199/blog/item/66df72014f4ae1d1267fb5ea.html

apache 22

./configure \
--prefix=/servers/httpd22 \
--with-mpm=worker \
--enable-rewrite \
--enable-speling \
--enable-so \
--disable-authz-host \
--disable-authz-groupfile \
--disable-authz-user \
--disable-authz-default \
--disable-status \
--disable-auth-basic

--disable-authn-file \

 


  mod_authn_file.c
  mod_authn_default.c
  mod_auth_basic.c

解决apache服务器的time_wait和fin_wait1过多等问题

对一些大流量的web服务器来说,比较常见的问题就是time_wait会很多,起因大多都是apache里 keepalive 没开的原因,将这个开启,相对会少一些,但大流量时还是比较多,这里还有另外一个参数设置

net.ipv4.tcp_max_tw_buckets = 5000

如果不想time_wait不要太多,只要把这个值调低,就肯定不会超过了

但会出现一个新问题,就是在系统日志里,会很多类似这样的警告

Nov 27 15:50:01 localhost kernel: printk: 9498 messages suppressed.
Nov 27 15:50:01 localhost kernel: TCP: time wait bucket table overflow
Nov 27 15:50:06 localhost kernel: printk: 9562 messages suppressed.
Nov 27 15:50:06 localhost kernel: TCP: time wait bucket table overflow
Nov 27 15:50:11 localhost kernel: printk: 10120 messages suppressed.
Nov 27 15:50:11 localhost kernel: TCP: time wait bucket table overflow
Nov 27 15:50:16 localhost kernel: printk: 9182 messages suppressed.
Nov 27 15:50:16 localhost kernel: TCP: time wait bucket table overflow
Nov 27 15:50:21 localhost kernel: printk: 9626 messages suppressed.

这个警告其实不影响使用和性能,只是烦而已。我曾为避免这个提示,就将 net.ipv4.tcp_max_tw_buckets 调得很大,接着 time_wait 也就很大了。这也是上面这个问题,在网上搜索到的解决办法了。不想这个警告出现,重新编译内核,可以避免。

还有另一外问题,就是 fin_wait1 过多的问题,这个情况,一般的服务器上不会有。至少我的情况是这样

但在用了集群/负载均衡(LVS)中,下面的机器,就有这种情况,也曾为解决这个问题苦恼了挺久,经过今天的测试,也可以解决了。

只要在/etc/sysctl.conf 中加入

net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_retries2 = 5
net.ipv4.tcp_orphan_retries = 3
net.ipv4.tcp_reordering = 5
net.ipv4.tcp_retrans_collapse = 0

就会减少很多了,关键的是 net.ipv4.tcp_orphan_retries 这个

apache+ssl

安装升级ssl
rpm -qa | grep "openssl"
yum update openssl


http://labs.xiaonei.com/apache-mirror/httpd/httpd-2.0.63.tar.gz
http://cn2.php.net/get/php-5.3.0.tar.gz/from/this/mirror
http://cn.php.net/get/php-5.2.10.tar.gz/from/cn2.php.net/mirror
http://www.openssl.org/source/openssl-0.9.8k.tar.gz

openssl
tar && cd
./config;make;make install

tar && cd
./configure --prefix=/www/servers/httpd20 --enable-so --with-rewrite --enable-expires --enable-ssl --with-ssl=/usr
or
./configure --prefix=/www/servers/httpd20 --enable-so --enable-ssl=static --with-ssl=/usr/local/ssl

make;make install


php (5.3无法解释PHP)
tar && cd
./configure --prefix=/www/servers/php5 --with-apxs2=/www/servers/httpd201/bin/apxs --with-mysql=/www/servers/mysql5 --with-gd=/usr/local/gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr --enable-gd-native-ttf --with-zlib --with-freetype-dir=/usr/local/freetype --with-iconv --enable-mbstring --enable-ftp

 


faq
Q:
Session Cache is not configured

Q:
打开网页提示选择证书
A:
ssl.conf
SSLVerifyClient require
SSLVerifyDepth  10


URL:
http://snailwarrior.blog.51cto.com/680306/137657
http://www.javayou.com/diary/617

centos5 x86_64

yum install gcc
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package gcc.x86_64 0:4.1.2-42.el5 set to be updated
--> Running transaction check
--> Processing Dependency: libgomp = 4.1.2-42.el5 for package: gcc
--> Processing Dependency: cpp = 4.1.2-42.el5 for package: gcc
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc
--> Processing Dependency: libgomp.so.1()(64bit) for package: gcc
--> Processing Dependency: libgcc >= 4.1.2-42.el5 for package: gcc
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Package cpp.x86_64 0:4.1.2-42.el5 set to be updated
---> Package libgomp.x86_64 0:4.1.2-42.el5 set to be updated
---> Package glibc-devel.x86_64 0:2.5-24.el5_2.2 set to be updated
---> Package libgcc.x86_64 0:4.1.2-42.el5 set to be updated
--> Running transaction check
--> Processing Dependency: glibc-headers for package: glibc-devel
--> Processing Dependency: glibc = 2.5-24.el5_2.2 for package: glibc-devel
--> Processing Dependency: glibc-headers = 2.5-24.el5_2.2 for package: glibc-devel
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Package glibc.x86_64 0:2.5-24.el5_2.2 set to be updated
---> Package glibc-headers.x86_64 0:2.5-24.el5_2.2 set to be updated
--> Running transaction check
--> Processing Dependency: glibc-common = 2.5-24.el5_2.2 for package: glibc
--> Processing Dependency: kernel-headers for package: glibc-headers
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Package glibc-common.x86_64 0:2.5-24.el5_2.2 set to be updated
---> Package kernel-headers.x86_64 0:2.6.18-92.1.22.el5 set to be updated
--> Running transaction check
--> Processing Dependency: glibc-common = 2.5-18 for package: glibc
Error: No Package Matching glibc.i686


出现Error: No Package Matching glibc.i686的问题解决办法
yum install glibc glibc.i386 --enablerepo=c532*

再yum install gcc
就OK了


c++,g++
yum install gcc-c++


web env
mysql
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/www/servers/mysql --enable-assembler --with-mysqld-ldflags=-all-static --enable-thread-safe-client --with-extra-charsets=gb2312,gbk,utf8,latin1 --with-named-curses-libs=/usr/lib/libncursesw.so.5

err
/usr/lib/libncursesw.so.5: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [mysql] Error 1
make[2]: Leaving directory `/home/r00t/mysql-5.0.77/client'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/r00t/mysql-5.0.77'
make: *** [all] Error 2

change
--with-named-curses-libs=/usr/lib64/libncursesw.so.5


php
./configure --prefix=/www/servers/php --with-apxs2=/www/servers/httpd20/bin/apxs --with-mysql=/www/servers/mysql --with-iconv --enable-mbstring --enable-ftp --with-libxml2-dir=/usr

err
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.

yum install libxml2-devel

err
Configuring extensions
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path... /usr/bin/xml2-config
checking whether libxml build works... no
configure: error: build test failed.  Please check the config.log for details.


ftp://xmlsoft.org/libxml2/
ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
tar zxvf
./configure --prefix=/usr/local/libxml2
make

collect2: ld returned 1 exit status
make[2]: *** [xmllint] Error 1
make[2]: Leaving directory `/home/r00t/php-5.2.9/libxml2-2.7.3'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/r00t/php-5.2.9/libxml2-2.7.3'
make: *** [all] Error 2


在configure 加上 --without-zlib 可以编译通过

++
--with-libxml2-dir=/usr/local/libxml2

 

 

----------------------------------------------------------------

usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC/usr/local/lib/libz.a: could not read symbols: Bad value解决方法如下:

cd zlib-1.2.3 //进入zlib目录
CFLAGS="-O3 -fPIC" ./configure   //使用64位元的方法进行编译
make
make installmake clean


错误提示:
/usr/bin/ld: /usr/local/lib/libjpeg.a(jcapimin.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

进入Jpeg目录
CFLAGS="-O3 -fPIC" ./configure
make
make install-lib


在Linux-x86_64环境下编译php5
LDFLAGS="-L/usr/lib64 -L/lib64" ./configure --prefix=/

rhel 5.3

 ./configure --prefix=/www/servers/mysql --enable-assembler --enable-thread-safe-client --with-extra-charsets=gb2312,gbk,utf8,latin1

err
checking for termcap functions library... configure: error: No curses/termcap library found

++
--with-named-curses-libs=/usr/lib/libncursesw.so.5

ab结果

装好web环境,也总会用ab测试一下,可总记不住这结果,每过段时间就没印像了.所以,以后将在这贴上每次(或大部分)新配置机器的ab结果,并大概列一下,以便日后参考之用.

硬件,好像是HP的机器,具体是 Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz,四核,2Gram,4个sas阵列(具体的方式不确定)

软件 redhat 5.3,简单配置,就apache+php+mysql,无GD等.

Concurrency Level:      300
Time taken for tests:   4.144159 seconds
Complete requests:      10000
Failed requests:        24
   (Connect: 0, Length: 24, Exceptions: 0)
Write errors:           0
Total transferred:      428575280 bytes
HTML transferred:       426902345 bytes
Requests per second:    2413.03 [#/sec] (mean)
Time per request:       124.325 [ms] (mean)
Time per request:       0.414 [ms] (mean, across all concurrent requests)
Transfer rate:          100992.75 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1   42 251.5     22    3021
Processing:    35   75  15.4     75     316
Waiting:        3   36  18.4     40     284
Total:         49  117 255.1     96    3318

Percentage of the requests served within a certain time (ms)
  50%     96
  66%    100
  75%    103
  80%    105
  90%    113
  95%    117
  98%    122
  99%    139
 100%   3318 (longest request)

Records:6212345678