SOFTELメモ Developer's blog

会社概要 ブログ 調査依頼 採用情報 ...
技術者募集中

【php】CentOS6(Scientific Linux 6)にて php4がコンパイルできない(別解)

問題

CentOS6(RedHat6系)でphp4がコンパイルできないのですが。

OpenSSLのライブラリのバージョンが合わないらしく(0.9.8系と1系)、configureできてもmakeのときにエラーとなったりします。

php-med-trans

/usr/local/src/php-4.4.9/ext/openssl/openssl.c:1913: error: 'struct php_x509_request' has no member named 'priv_key'
/usr/local/src/php-4.4.9/ext/openssl/openssl.c: In function 'zif_openssl_pkey_export_to_file':
/usr/local/src/php-4.4.9/ext/openssl/openssl.c:1955: error: 'struct php_x509_request' has no member named 'priv_key_encrypt'
/usr/local/src/php-4.4.9/ext/openssl/openssl.c: In function 'zif_openssl_pkey_export':
/usr/local/src/php-4.4.9/ext/openssl/openssl.c:2006: error: 'struct php_x509_request' has no member named 'priv_key_encrypt'
make: *** [ext/openssl/openssl.lo] エラー 1

答え

今どきphp4の使用は避けたいとは思いますが、そうも行かないこともあるもので。


php4のソースの openssl.c を openssl1.0.0に合わせる方法がある。

./ext/openssl/openssl.c を こちらの openssl.c に差し替える。(念のため保存

後は、通常通りでOK。

# ./configure --with-apxs2 --enable-zend-multibyte --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-zlib=/usr --with-png-dir=/usr --enable-iconv --enable-bcmath --enable-ftp --with-regex=php --with-mysql --with-curl --enable-trans-sid --with-mysqli --with-pdo-mysql --with-imap=shared,/usr/local/lib/imap-2007d --with-imap-ssl=shared --enable-memory-limit --enable-sigchild --with-xsl --with-openssl=shared --with-kerberos
# make
# make install

参考

http://www.xinfoline.com/

備考

cannot restore segment prot after reloc: Permission denied などのエラーが出たら、selinuxが影響していると思うので、selinuxをdisabledにする。

$ setenforce 0

もしくは

vi /etc/sysconfig/selinux
SELINUX=enforcing
           ↓
SELINUX=disabled

もしくは、selinux有効のまま、

chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t ○○○○○○.so

メモ) http://wiki.tkr.mydns.jp/index.php?title=Linux%E9%96%A2%E9%80%A3/Apache%2BOpenSSL-1.0.0%E3%81%A7%E3%81%AE%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%AB%E6%99%82%E3%81%AE%E5%95%8F%E9%A1%8C

関連するメモ

コメント