1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHPエクステンションを作ってハマったメモ

Last updated at Posted at 2016-09-30

php7.0.11で作成したsoファイルを他のサーバーに持っていったら読み込めない・・

Apacheのログを見るとpermission deniedの文字列。

「なに!」「権限だと!」

ls -l コマンドでファイルの権限を確認したが問題なし。

ls -lZ コマンドでSELinuxのコンテキストを確認すると、他のファイルと違う。

「これか!」

chcon コマンドを叩いて、他のファイルと同じコンテキストに設定した。

「よしこれで動くはずだ」

だがしかし、apacheを再起動し php -v コマンドを叩いてみると
モジュールをロードできていない旨の文字列。

soファイルの作成に使ったPHPと、サーバーにインストールしてあるPHPのバージョンは同じ。

だが警告には、soファイルが debug 用だと表示されていた。

「んーおかしい」「デバッグ・オプションを外したPHPでsoファイルを作成したはずなのに。」

・・・・

「もしかしてキャッシュか?」

soファイルのソースコードが置いてあるディレクトリに入り、make clean all コマンドを叩いた。

そして

make install

デバッグと表示されていたsoファイルよりも容量の大きいsoファイルが生成された。

再度サーバーにsoファイルを持っていきapacheを再起動したら

無事に作成したphpエクステンションが動きました。

2日もハマった・・

でもハマるといろいろ調べるからお勉強になる。

I think, If I want to do something, I just do it.

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?