在linux中安裝應用程序時出現的問題

 

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章