LoginSignup
1
1

More than 5 years have passed since last update.

【学習メモ】 CentOS6.10とMySQL5.6.40とphp7.2.4でPHPのenable-zipオプションを付けるとconfigureでoff_tのエラー

Last updated at Posted at 2018-09-25

はじめに

--enable-zipのオプションを付けるとconfigureでエラーが出ていましたが、以下で解決しました。

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum --enablerepo=remi install libzip-last-devel
yum install libxslt-devel

MySQLはソースインストールしておりconfigure前にexport LD_LIBRARY_PATH=/usr/local/mysql/libを実行しています。

環境
CentOS6.10, Apache2.4.34, PHP7.2.10, MySql5.6.41

エラーの内容

 - checking size of short... (cached) 2
 - checking size of int... (cached) 4
 - checking size of long... (cached) 8
 - checking size of long long... (cached) 8
 - checking size of off_t... 0
 - configure: error: off_t undefined; check your library configuration

参考資料
Bug #68302 impossible to compile php with zip support(bugs.php.net)

やってだめだったこと

libzipのインストール

yum remove libzipでアンインストールしたあと、libzipの1.2をインストール。
2018年9月現在最新の1.5は、CentOS6.10でyumインストールできるcmakeのバージョンでは古いと言われてしまう。

cd /usr/local/src
wget https://github.com/nih-at/libzip/archive/rel-1-2-0.tar.gz
tar xf rel-1-2-0.tar.gz
cd libzip-rel-1-2-0
mkdir build
cd build
cmake ..
make && make install

うまくいったこと

libzipのインストール(その2)

libxslt-develも一緒に入れます。

yum remove libzip libzip-devel
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum --enablerepo=remi install libzip-last-devel libxlst-devel

CentOS7のとき

yum remove libzip libzip-devel
yum install -y epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum --enablerepo=remi install libzip-last-devel libxslt-devel

参考資料
[メモ]PHP7.2.xインストール(blog.tkouen.mydns.jp)

その他コンパイルオプション

with-mysqliとwith-pdo-mysqlの設定でエラーの内容が変わりました。

NGパターン1

--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql/mysql_config \
致命的エラー: my_global.h: そのようなファイルやディレクトリはありません
 #include <my_global.h>
                       ^                                                                                                            
コンパイルを停止しました。
make: *** [ext/mysqli/mysqli.lo] エラー 1

mysql8.0.0(dev.mysql.com)のソースには、includeの中にmy_global.hがあるようですが、現在のmysql8.0.13のソースを開いてもありません。phpbugフォーラム(bugs.php.net)にそれっぽいのがありました。libmysqlは使うなと。
PHPのどのライブラリを選ぶか(php.net)にもlibmysqlclientを使ってのコンパイルはおすすめしない方法とあります。

./configure --helpでは、--with-pdo-mysql=DIR PDO: MySQL support. DIR is the MySQL base directoryとディレクトリを指定するようありますが、PHPのライブラリ選択のコンパイル例では--with-pdo-mysql=/path/to/mysql_configとあるので指定してみましたが結果は一緒でした。

NGパターン2

--with-mysqli=mysqlnd \
--with-pdo-mysql=/usr/local/mysql/bin/mysql_config \
 エラー: 不明な型名 ‘my_bool’ です                          
  my_bool     *out_null;
  ^                                                                                                                                 
make: *** [ext/pdo_mysql/pdo_mysql.lo] エラー 1

OKパターン

当然といえば当然ですが…

--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql/bin/mysql_config \
--with-mysql=/usr/local/mysql/bin/mysql_config \
--with-mysqli \
--with-pdo-mysql \
--with-mysql \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql=mysqlnd \

解決していないPHPコンパイル時のWarning

OpenSSL 1.0.2pをソースインストールしています。

/usr/bin/ld: warning: libcrypto.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libnetsnmp.so, may conflict with libcrypto.so.1.0.0
/usr/bin/ld: warning: libcrypto.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libnetsnmp.so, may conflict with libcrypto.so.1.0.0
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib64/libssh2.so.1, may conflict with libssl.so.1.0.0
/usr/bin/ld: warning: libcrypto.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libnetsnmp.so, may conflict with libcrypto.so.1.0.0
/usr/bin/ld: warning: libcrypto.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libnetsnmp.so, may conflict with libcrypto.so.1.0.0
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib64/libssh2.so.1, may conflict with libssl.so.1.0.0
Generating phar.php
/usr/bin/ld: warning: libcrypto.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libnetsnmp.so, may conflict with libcrypto.so.1.0.0
/usr/bin/ld: warning: libcrypto.so.10, needed by /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libnetsnmp.so, may conflict with libcrypto.so.1.0.0
/usr/bin/ld: warning: libssl.so.10, needed by /usr/lib64/libssh2.so.1, may conflict with libssl.so.1.0.0
Generating phar.phar
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1