歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> 64位系統下編譯PHP找不到庫文件問題

64位系統下編譯PHP找不到庫文件問題

日期:2017/3/1 10:14:23   编辑:Linux編程

最近在64位系統上編譯5.4.5版的PHP時,遇到報以下錯:

  1. checking for DSA_get_default_method in -lssl... yes
  2. checking for X509_free in -lcrypto... yes
  3. checking for pkg-config... /usr/bin/pkg-config
  4. configure: error: Cannot find OpenSSL's libraries

指定的編譯參數:

  1. ./configure \
  2. --prefix=/usr/local/services/php-5.4.5 \
  3. --with-config-file-path=/usr/local/services/php-5.4.5/etc \
  4. --enable-fpm \
  5. --enable-mbstring \
  6. --enable-soap \
  7. --enable-sockets \
  8. --enable-zip \
  9. --with-curl=/usr \
  10. --with-mysql=mysqlnd \
  11. --with-mysqli=mysqlnd \
  12. --with-pdo-mysql=mysqlnd \
  13. --with-gd \
  14. --with-jpeg-dir=/usr \
  15. --with-png-dir=/usr \
  16. --with-zlib-dir=/usr \
  17. --with-freetype-dir=/usr \
  18. --with-openssl=/usr

找不到openssl的庫文件,但我明明有安裝openssl-devel的,很奇怪,網上搜了一下,發現有很多朋友,遇到了同樣的問題,有些人說--with-openssl不指定路徑可解決,嘗試了一下,的確編譯通過了,但想不通,Why?後來,又搜了一些文章來看,終於找出問題的根源:安裝的系統是64位的,而64位的用戶庫文件默認是在/usr/lib64,而我編譯的時候,沒有指定--with-libdir=lib64,而編譯腳本默認是lib,這當然是找不到的。

將編譯參數更改為:

  1. ./configure \
  2. --prefix=/usr/local/services/php-5.4.5 \
  3. --with-config-file-path=/usr/local/services/php-5.4.5/etc \
  4. --enable-fpm \
  5. --enable-mbstring \
  6. --enable-soap \
  7. --enable-sockets \
  8. --enable-zip \
  9. --with-curl=/usr \
  10. --with-mysql=mysqlnd \
  11. --with-mysqli=mysqlnd \
  12. --with-pdo-mysql=mysqlnd \
  13. --with-gd \
  14. --with-jpeg-dir=/usr \
  15. --with-png-dir=/usr \
  16. --with-zlib-dir=/usr \
  17. --with-freetype-dir=/usr \
  18. --with-openssl=/usr \
  19. --with-libdir=lib64

問題解決。

Copyright © Linux教程網 All Rights Reserved