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

bin/httpd: error while loading shared libraries: libiconv.so.2

./configure --prefix=/usr/local/phpa --with-apxs2=/usr/local/httpd20/bin/apxs --with-mysql=/usr/local/mysql --with-mcrypt=/usr --with-gd=/usr --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-ttf --with-zlib --with-freetype-dir=/usr --with-iconv --enable-mbstring --enable-ftp

提示

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS...

Sorry, I was not able to successfully run APXS.  Possible reasons:

1.  Perl is not installed;
2.  Apache was not compiled with DSO support (--enable-module=so);
3.  'apxs' is not in your path.  Try to use --with-apxs=/path/to/apxs
The output of /usr/local/webserver/httpd20/bin/apxs follows
/usr/local/webserver/httpd20/bin/httpd: error while loading shared libraries: libiconv.so.2: cannot open shared ob
ject file: No such file or directory
apxs:Error: Sorry, no shared object support for Apache.
apxs:Error: available under your platform. Make sure.
apxs:Error: the Apache module mod_so is compiled into.
apxs:Error: your server binary `/usr/local/webserver/httpd20/bin/httpd'..
configure: error: Aborting


运行 ldd /usr/local/webserver/httpd20/bin/httpd
提示找不到
libiconv.so.2 => not found

查找 libiconv.so.2 ,并复制到 httpd20/lib下,编译成功

 

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... configure: error: You have enabled Apache 1.3 suppo
rt while your server is Apache 2.  Please use the appropiate switch --with-apxs2

把--with-apxs 改为 --with-apxs2
记得比较早以前,在apache2时是要加2的,但之前的好一段时间,似乎都没加也一样可以.有点糊涂了.


configure: error: Unable to find gd.h anywhere under /usr
安装gd-devel
yum install gd-devel


ext/iconv/.libs/iconv.o: In function `_php_iconv_strlen':
/root/php-5.2.8/ext/iconv/iconv.c:603: undefined reference to `libiconv_open'
/root/php-5.2.8/ext/iconv/iconv.c:626: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:660: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `php_iconv_string':
/root/php-5.2.8/ext/iconv/iconv.c:441: undefined reference to `libiconv_open'
/root/php-5.2.8/ext/iconv/iconv.c:453: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:467: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:478: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_strpos':
/root/php-5.2.8/ext/iconv/iconv.c:851: undefined reference to `libiconv_open'
/root/php-5.2.8/ext/iconv/iconv.c:879: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:993: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_appendl':
/root/php-5.2.8/ext/iconv/iconv.c:348: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:385: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `_php_iconv_substr':
/root/php-5.2.8/ext/iconv/iconv.c:723: undefined reference to `libiconv_open'
/root/php-5.2.8/ext/iconv/iconv.c:747: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:802: undefined reference to `libiconv_close'
/root/php-5.2.8/ext/iconv/iconv.c:806: undefined reference to `libiconv_close'
/root/php-5.2.8/ext/iconv/iconv.c:755: undefined reference to `libiconv_open'
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_decode':
/root/php-5.2.8/ext/iconv/iconv.c:1354: undefined reference to `libiconv_open'
/root/php-5.2.8/ext/iconv/iconv.c:1465: undefined reference to `libiconv_close'
/root/php-5.2.8/ext/iconv/iconv.c:1468: undefined reference to `libiconv_open'
/root/php-5.2.8/ext/iconv/iconv.c:1823: undefined reference to `libiconv_close'
/root/php-5.2.8/ext/iconv/iconv.c:1826: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_dtor':
/root/php-5.2.8/ext/iconv/iconv.c:2465: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_encode':
/root/php-5.2.8/ext/iconv/iconv.c:1043: undefined reference to `libiconv_open'
/root/php-5.2.8/ext/iconv/iconv.c:1057: undefined reference to `libiconv_open'
/root/php-5.2.8/ext/iconv/iconv.c:1316: undefined reference to `libiconv_close'
/root/php-5.2.8/ext/iconv/iconv.c:1319: undefined reference to `libiconv_close'
/root/php-5.2.8/ext/iconv/iconv.c:1176: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:1128: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:1160: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:1319: undefined reference to `libiconv_close'
/root/php-5.2.8/ext/iconv/iconv.c:1228: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:1259: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:1303: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_append_bucket':
/root/php-5.2.8/ext/iconv/iconv.c:2615: undefined reference to `libiconv'
/root/php-5.2.8/ext/iconv/iconv.c:2537: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':
/root/php-5.2.8/ext/iconv/iconv.c:2491: undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

configure: error: No curses/termcap library found

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

安装 ncurses

还不行的话,加上 ./configure --with-named-curses-libs=/usr/lib/libncursesw.so.5

 

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

Notice: Following unknown configure options were used:

--with-png


--with-png-dir=/usr

apache2+php5.2,启动cache

./configure --prefix=/www/httpd --with-mpm=worker --enable-so --enable-rewrite --enable-cache --enable-mem-cache --enable-disk-cache --enable-static-htcacheclean  --enable-speling

./configure --prefix=/www/php --with-apxs2=/www/httpd/bin/apxs --with-gd=/usr/local/gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr --with-ttf --with-zlib --with-freetype-dir=/usr/local/freetype --with-mysql=/www/mysql4118 --with-iconv --enable-mbstring --enable-ftp --with-curl --enable-maintainer-zts


php-5.2.8
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient_r under /www/servers/mysql4118.
Note that the MySQL client library is not bundled anymore!
要求mysql也要加上 --enable-thread-safe-client.
解决方法一:重新编译安装MYSQL的时候加上 --enable-thread-safe-client.
原因:--enable-thread-safe-client    #Compile the client with threads. 如果没有这个参数,编译php的时候会报"Cannot find libmysqlclient_r under”之类的错误。
其实这跟PHP没有关系
那是因为我在编译APACHE的时候,使用--with-mpm模块,所以就必须在编译MYSQL的时候加上 --enable-thread-safe-client.
这是PHP5.2的一个改进,在PHP5.2.0之前的版本都不需要MYSQL启用安全线程

解决方法二:编译之前,先处理一下mysql的库,默认查找libmysqlclient_r.so,可是mysql默认为libmysqlclient.so,内容完全一样,做个链接即可
# cd /data/mysql/lib/mysql/
# ln -s libmysqlclient.so.15.0.0 libmysqlclient_r.so
照做。
再次重新编译安装PHP
顺利通过!

 

php-5.2.8
[Fri Dec 19 15:55:51 2008] [crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be thre
adsafe.  You need to recompile PHP.
Pre-configuration failed

编译apache启用了worker的mpm,编译PHP时就提示上面的.网上资料说,要在编译PHP也要加上相应的参数  --enable-maintainer-zts,但问题仍就,最后把apache的worker给取消就正常了.暂时试用段时间看

Apache+php文件扩展名解析漏洞

也就是不管最后后缀为什么,只要是.php.*结尾,且没在mime.types定义的,都将会被Apache服务器解析成php文件

这主要是对有上传功能的服务器比较危险,解决的办法是对允许上传的文件类型,在mime.types文件中定义即可,或者升级最新版本的apache,php

....

rar

 

Apache服务器限制并发连接和下载速度

最近,FTP下载带宽太大,找了个限制带宽的,效果不错

http://ivn.cl/apache

http://ivn.cl/files/source/mod_bw-0.8.tgz

<VirtualHost *>
    BandwidthModule On
    ForceBandWidthModule On
    Bandwidth all 30720
    MinBandwidth all -1
</VirtualHost>

限制最大为30K

参考

目前各种多线程下载工具泛滥,这对提供部分下载功能的网站来说是个比较头疼的问题,由于多线程下载会给服务器带来巨大的负载压力,而且可能会对整个站点产生影响,使其不能正常访问。那么有没有什么方法可以解决这些问题呢?答案是肯定的。目前国内大部分站点都是基于LAMP(Linux+Apache+Mysql+php)架构的,Apache是一个开源的,功能强大,稳定,使用量最大的WEB服务器。Apache是模块化开发的,可以根据需要增加各种功能模块,这里我给大家介绍两个模块,一个是mod_limitipconn,另一个是bw_mod。

     下面说一下它们的安装配置,它们的下载地址是:
    mod_limitipconn:http://dominia.org/djao/limitipconn.html
    bw_mod:http://www.ivn.cl/

一、mod_limitipconn

    mod_limitipconn,这个是Apache的一个非官方模块,根据同一个来源IP进行并发连接控制,它是使用ExtendedStatus On的形式,工作在应用层。当同一个源IP的连接到达限制的时候,apache对get请求发送: HTTP/1.1 503 Service Temporarily Unavailable,使用户不能进行多线程下载,但并不能阻止攻击。目前它的最新版本是0.22,支持Apache 2.0。
 
下载:wget http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz
解压:tar zxvf mod_limitipconn-0.22.tar.gz;
安装:在进行安装前要确认apxs文件的位置,要使用whereis apxs命令查找apxs文件的位置。可以通过两种方法进行安装。
    一种方法是修改mod_limitipconn的Makefile文件,确保Makefile文件中APXS=指向正确的apxs文件。
然后输入:make install 
另一种方法就是直接用apxs命令进行编译安装,如:
/usr/local/apache/bin/apxs –c –i – a mod_limitipconn.c 
修改Apache的配置文件httpd.conf:
1.找到ExtendedStatus On,如果前面有#号的话要把#号去掉,如果没有这个选项需要自己手工添加;
2.确认LoadModule limitipconn_module /usr/lib/apache/mod_limitipconn.so这个选项存在;
3.在httpd.conf进行mod_limitipconn配置,配置示例如下:
<IfModule mod_limitipconn.c>
<Location /> #要限制的目录,此处表示的根目录
MaxConnPerIP 3 #要限制每个IP的并发连接数,此处为3
NoIPLimit image/* #对图片文件夹不做IP限制
</Location>
<Location /mp3> #要限制的目录,此处表示/mp3目录
MaxConnPerIP 1 #限制每个IP的并发连接数为1个
OnlyIPLimit audio/mpeg video #该限制只对视频和音频格式的文件
</Location>
</IfModule>
            4.重启Apache,这时可以用多线程下载工具下载文件试一下。

二、bw_mod

Bw_mod,它可以根据来源IP进行带宽限制。
       下载:wget http://www.ivn.cl/files/source/bw_mod-0.6.tgz
       解压:tar zxvf bw_mod-0.6.tgz
安装:通过whereis apxs命令找到apxs命令的位置,如apxs的位置是:/usr/local/apache/bin/apxs,那么我们就可以通过:
/usr/local/apache/bin/apxs –c –i –a命令进行安装。
修改Apache的配置文件httpd.conf。
1.确认LoadModule bw_module modules/bw_mod-0.6.so选项已经存在。
2.配置示例:
BandWidthModule On                 #启用bw_mod
BandWidth    all 102400              #最高为为100kB
MinBandWidth all 51200              #最低为50KB
MaxConnection all 3                   #所有客户端最多3个连接
LargeFileLimit .rar 30 23000         #限制所有大于30K的后缀名为.rar的文件的
                                                 速率为23000字节/秒,即23K/秒
3.重启Apache
       以上只说了一下这两个模块的安装和简单的配置,更具体的配置请看这两个模块的说明文件。

Cannot allocate memory: apr_thread_create: unable to create worker thread

日志里显示

Cannot allocate memory: apr_thread_create: unable to create worker thread

调整 ThreadsPerChild 参数

用apache配置大型的动态虚拟主机

早在04年初的时候,就知道apache能配置大型的虚拟主机.比如那些提供免费空间的.因为当时所在的公司就有这个提供.但自己当时也没怎么去留意.这种配置可以少去很多烦琐的工作.配置也分好多种.这里所说的是针对二级域名的.比如 abc.51099.com

前几天测试,还以为一个IP,只能配置一个这样的动态应用,还在想,应该也能支持多个以上.今天有空又再测试一下.果真是没问题的.只要相应的配置servername/serveralias就可以了

因为迟点会做一个相应关的项目.呵呵,真爽

参考文档 http://man.chinaunix.net/newsoft/ApacheManual/vhosts/mass.html

让apache为访问文件加上一个超时时间,expires

apache文件所在目录 modules/metadata/mod_expires.c

编译,使用apxs工具

apachepath/bin/apxs -c -i -a mod_expires.c

 编译完后,自动加了LoadModule

httpd.conf配置

<IfModule expires_module>
    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 3 minutes"
    ExpiresByType application/x-shockwave-flash "access plus 300 minutes"
    #ExpiresByType image/gif "access plus 3 minutes"
    #ExpiresByType image/jpeg "access plus 3 minutes"
    #ExpiresByType image/png "access plus 3 minutes"
    #ExpiresByType text/css "access plus 3 minutes"
    #ExpiresByType application/x-shockwave-flash "access plus 3 minutes"
    #ExpiresDefault "now plus 1 day"
</IfModule>

Records:6212345678