在linux中安装应用程序时出现的问题

来源:互联网 发布:手机优化软件排名第一 编辑:程序博客网 时间:2024/03/29 04:34
 1、centos5.5里安装软件时发现了访问权限的问题:

SELinux和iptables


cannot restore segment prot after reloc: Permission denied
############################


在red hat linux上安装有些东西时会出现 Permission denied 的情况:以下就是解决它的办法之一
编辑/etc/selinux/config,找到这段:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing

把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:
SELINUX=disabled
保存,关闭。

如果你碰到其他类似提示:

cannot restore segment prot after reloc: Permission denied
就应该是SELinux的问题,可以考虑把它关闭。

如果把SELinux关闭后还是不行.执行如下步骤即可
在你保证SElinux 被disable后.还执行下
chcon -t texrel_shlib_t
如: chcon -t texrel_shlib_t /路径/路径/名字.so (这个文件视具体执行文件.)
以上两步.已经解决了很多server的问题了.


2、
这里显示一个错误信息:
checking for LIBXML2... configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:
No package 'libxml-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBXML2_CFLAGS
and LIBXML2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
但是我们在上面其实已经安装上 libxml2 了的,这里只是一个 环境变量没有设置好而已。
解决办法: 确定 /usr/local/libxml2/lib/pkgconfig 目录下有 libxml-2.0.pc
export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
再次生成 makefile , 这样就成功了

3、

CentOS 5.5上安装PHP,结果configure的时候错误了。命令行下提示:
configure: error: build test failed.  Please check the config.log for details.
下载config.log,最后的信息是:
configure:20548: checking for xml2-config path
configure:20706: checking whether libxml build works
configure:20733: gcc -o conftest -g -O2   -Wl,-rpath,/home/wulijun/lib/lib -L/home/wulijun/lib/lib conftest.c 
    -lrt -lresolv -lm -ldl -lnsl  -lrt -lxml2 -lz -liconv -lm 1>&5
configure: failed program was:
#line 20722 "configure"

#include "confdefs.h"

    char xmlInitParser();
    int main() {
      xmlInitParser();
      return 0;
   }

解决方法如下:
1)在PHP源码下面创建文件conftest.c,内容为config.log中的提示内容:

#include "confdefs.h"

    char xmlInitParser();
    int main() {
      xmlInitParser();
      return 0;
   }
2)使用提示中的:
gcc -o conftest -g -O2   -Wl,-rpath,/home/wulijun/lib/lib -L/home/wulijun/lib/lib conftest.c 
    -lrt -lresolv -lm -ldl -lnsl  -lrt -lxml2 -lz -liconv -lm
命令对conftest.c进行编译,如果编译出现错误,那么这个错误就是PHP无法编译的一个原因,需要先解决。
3)执行刚才编译出来的conftest,如果没有执行权限需要先加上(这一步是从configure这个脚本里看到的,他检查时就是这么做的)。如果报错,那么这个错误也是PHP无法编译的原因。我的情况就是这个,执行后提示:./conftest: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory