Dutch PHP Conference 2025 - Call For Papers

Paylaşımlı PECL eklentilerinin phpize ile derlenmesi

pecl komutu ile kurulumun mümkün olmadığı durumlar olabilir. Bir güvenlik duvarı etkin olabilir veya eklentinin PECL uyumlu paketi yoktur ya da henüz dağıtılmamış git sürümü kurulmak isteniyordur, vs. Böyle bir eklentinin derleme işlemi daha temel derleme araçları (make gibi) kullanılarak gerçekleştirilebilir.

Bir PHP eklentisini derleme işlemine hazırlamak için phpize komutu kullanılır. Aşağıdaki örnekte, eklentinin kaynak kod paketinin eklenti dizininde bulunduğu varsayılmıştır:

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

Başarılı bir kurulum sonucunda eklenti PHP eklentileri dizinine eklenti.so adıyla yerleştirilir. Eklentiyi etkin kılmak için php.ini dosyasına bir extension=eklenti.so satırı eklemek gerekecektir.

Eğer sistemde phpize komutu yoksa ve RPM gibi önceden derlenmiş paketler kullanılabiliyorsa, phpize komutunu ve PHP eklentilerini derlemek için gerekli başlık dosyalarını içermesi muhtemel uygun bir PHP geliştirme sürümünü kurmak gerekebilir.

Komutun kullanım bilgilerini görmek için phpize --help komutu verilmelidir.

add a note

User Contributed Notes 3 notes

up
70
Brian
16 years ago
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
up
9
admin at eexit dot net
12 years ago
When compiling an extension for a stack which is 64 bits (for example) and your compiler is configured to compile in 32 bits, you can manually compile your extensions using C flags before your configure.

Example: my system compiler is 32 bits and my stack is 64 bits. To compile my xdebug:

# phpize
# CFLAGS=-m64 CPPFLAGS=-m64 CCASFLAGS=-m64 ./configure --enable-xdebug
# gmake
# file modules/xdebug.so
modules/xdebug.so: ELF 64-bit LSB dynamic lib AMD64 Version 1, dynamically linked, not stripped, no debugging information available
up
-4
dmytton at php dot net
18 years ago
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.
To Top