PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

PECL 拡張モジュールを PHP に静的に組み込む> <共有 PECL 拡張モジュールを、pecl コマンドを用いてコンパイルする
Last updated: Fri, 18 Jul 2008

view this page in

phpize で共有 PECL 拡張モジュールをコンパイルする方法

時には pecl インストーラを使用するという選択肢が使えない場合もあります。 たとえばファイアウォールの内部で作業をしている場合がそうですし、 まだリリースされていない CVS 版のように PECL パッケージ形式になっていないものをインストールする場合も それにあてはまります。このようなモジュールをビルドする必要がある場合は、 より低レベルなビルドツールを使用して手動でビルドします。

PHP 拡張モジュールのビルド環境を準備するために、 phpize コマンドを使用します。以下の例では、 拡張モジュールのソースが extname というディレクトリにあると仮定します。

$ cd extname
$ phpize
$ ./configure
$ make
# make install

上手くいけば、extname.so が作成され、 それが PHP の 拡張モジュールディレクトリ に置かれます。 この拡張モジュールを使用する前に、php.iniextension=extname.so という行を追加する必要があります。

コンパイル済みのパッケージ (RPM など) を使用している場合などで、もし phpize コマンドが見つからない場合は、適切な devel 版の PHP パッケージをインストールしましょう。 PHP や拡張モジュールをビルドするために必要なヘッダファイルや phpize コマンドは、このパッケージに含まれます。

使用法についての詳細な情報を表示するには、 phpize --help を実行します。



add a note add a note User Contributed Notes
phpize で共有 PECL 拡張モジュールをコンパイルする方法
Brian
01-May-2008 08:39
If you have multiple PHP versions installed, you may be able to specify for which installation you'd like to build by using the --with-php-config option during configuration.

--with-php-config=[Insert path to proper php-config here]

For example (my case):
./configure --with-php-config=/usr/local/php5/bin/php-config5
Glen
18-May-2007 01:07
When you have multiple installations of PHP, running phpize from a specific installation will not force the module to be compiled with that installation's include files.

In my case, I had a standard PHP distribution installed, and am evaluating Zend Core / Zend Platform, which installed it's own Apache & PHP in a /usr/local/Zend/.. install path.  It was missing the json.so module, so I had to compile my own.

Running Zend Core's phpize, the output indicates that configuration for that module will occur.  But when running ./configure, the standard installation's include files are used.  The result json.so being compiled against the wrong PHP would not load when Zend Core's php initializes.

The only way I could see to correct the situation was to temporarily change the standard PHP include path to point to the Zend Core's include files.  In my case, I made a backup copy of /usr/include/php5 and did a "ln -s /usr/local/Zend/Core/include/php/ /usr/include/php5".
dmytton at php dot net
03-Dec-2005 08:45
In some situations (e.g. on a cPanel server), the built extension will not be placed into the correct extensions directory by the make install process. Use your phpinfo() output to determine what the correct extension_dir path is and move the generated .so file into that directory. The extension=extname.so line in php.ini will then find the extension file correctly.

 
show source | credits | sitemap | contact | advertising | mirror sites