Cara menggunakan php-zmq extension windows

Top Level :: Networking :: zmq :: 1.1.3 :: Windows

This package is not maintained, if you would like to take over please go to this page.

Package InformationSummaryZeroMQ messagingMaintainersMikko Koppanen < mkoppanen at php dot net > (lead) [wishlist] [details]
LicenseBSD LicenseDescriptionZeroMQ is a software library that lets you quickly design and implement a fast message-based applications.Release notes
Version 1.1.3
(beta)- Introduces PHP7 support. PHP5 compilation should work but receives no updates.
- Added new methods:
* ZMQSocket::monitor (and related ZMQSocket::recvEvent)
* ZMQ::z85Encode/Decode
* ZMQ::has
- Socket options are now restricted to their valid socket types
- Usage pthreads extension is now better supported and tested

In case of missing DLLs, consider to contact the PHP for Windows Team.

Dependencies for release 1.1.3PHP Version: PHP 5.3.0 or newer
PEAR Package: PEAR 1.4.0 or newer

Installing and configuring ZMQ:

The following exemples is based on Debian Linux  but it should work in other OS.

First:
Installing 0MQ:
Go to http://zeromq.org/area:download and choose a package according your OS, in my case I've choosed
POSIX tarball Stable Release 4.0.4.

    ~$ tar -xvf zeromq-4.0.4.tar
    ~$ cd zeromq-4.0.4
    ~$ ./configure
    ~$ make
    ~$ sudo make install

Ok, we just have installed ZMQ now need install zmq php binding...
Make sure you having php-dev and php pear installed. If no:

    ~$ sudo apt-get install php5-dev php-pear
    ~$ sudo pecl install zmq-beta

Ok, we have now ZMQ and php binding (ext-php) installed but we should add "extension=zmq.so" (Or extension=php_zmq.dll on windows) to php.ini:
In my case:

    ~$ sudo nano /etc/php5/apache2/php.ini

**NOTE:** If PHP version is 5.4.x you will need to add a zmq.ini file in /etc/php5/conf.d and put "extension=zmq.so":

    ~$ sudo nano /etc/php5/conf.d/20-zmq.ini

Reloadind HTTP server (in my case apache):

    ~$  sudo service apache2 reload

Cara menggunakan php-zmq extension windows

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Hmm, kebetulan sering lupa cara untuk install zmq extension di PHP. Dulu cukup menggunakan PECL pecl install zmq atau pecl install zmq-beta. Tapi semenjak PHP 7.2 cara tersebut tidak berhasil. Jadi saya dokumentasikan caranya melalui blog ini. Semoga bisa membantu yang lain juga.

Sebelum lanjut, pastikan sudah install PHP development packages. Di macOS sepertinya cukup dengan:

brew install php pkg-config zmq

Pada Ubuntu atau Linux Mint harus install php-dev dan build-essentials:

sudo apt install php-dev build-essentials

Kalau di Fedora, SUSE, ArchLinux (atau distro lain) bisa jadi berbeda nama package-nya. Silahkan cari informasinya sendiri.

Berikut cara untuk build manual di PHP 7.4 (cara yang sama bisa dipakai di 7.2 dan 7.3).

git clone https://github.com/zeromq/php-zmq.git
cd php-zmq
phpize
./configure
make
make install

Baca infonya yang muncul dimana file hasil compile zmq.so . Setelah itu pindahkan file tersebut ke directory sesuai dengan extension_dir yang ada di php.ini. Untuk mengecek gunakan php -i | grep extension_dir.

Setelah itu aktifkan extension dengan menambahkan

sudo apt install php-dev build-essentials
0 di file
sudo apt install php-dev build-essentials
1. Atau bisa juga di
sudo apt install php-dev build-essentials
2. Kalau di macOS dengan Homebrew lokasinya ada di
sudo apt install php-dev build-essentials
3.

Periksa dengan

sudo apt install php-dev build-essentials
4 apakah
sudo apt install php-dev build-essentials
5 sudah aktif atau belum. Kalau konfigurasi benar,
sudo apt install php-dev build-essentials
5 akan muncul di list module yang aktif.

Oh ya, cara ini juga bisa digunakan untuk compile extension yang lain. Misalnya mau compile MongoDB extension secara manual tanpa

sudo apt install php-dev build-essentials
7, cara di atas juga bisa digunakan.