Your requirements could not be resolved to an installable set of packages
Asked Answered
H

3

5

Sorry for duplication of this question with another one. I can't solve my problem.

I am working on a project based on Ratchet. I am trying to run the Push Integration example. So, in order to run, I should use composer to get some dependencies. I make a composer.json file like below:

{
    "autoload": {
        "psr-0": {
            "MyApp": "src"
        }
    },
    "require": {
        "cboden/ratchet": "0.3.*",
        "react/zmq": "0.2.*|0.3.*"
    }
}

When I execute composer on it, below error occurrs:

Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - react/zmq v0.3.0 requires ext-zmq * -> the requested PHP extension zmq is missing from your system.
    - react/zmq v0.2.0 requires ext-zmq * -> the requested PHP extension zmq is missing from your system.
    - Installation request for react/zmq 0.2.*|0.3.* -> satisfiable by react/zmq[v0.2.0, v0.3.0].

Below you can find composer.json of Ratchet and ZMQ:

ZMQ:

{
    "name": "react/zmq",
    "description": "ZeroMQ bindings for React.",
    "keywords": ["zmq", "zeromq"],
    "license": "MIT",
    "require": {
        "php": ">=5.4.0",
        "ext-zmq": "*",
        "evenement/evenement": "~2.0",
        "react/event-loop": "0.4.*"
    },
    "require-dev": {
        "ext-pcntl": "*"
    },
    "autoload": {
        "psr-0": { "React\\ZMQ": "src" }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "0.4-dev"
        }
    }
}

Ratchet:

{
    "name": "cboden/ratchet"
  , "type": "library"
  , "description": "PHP WebSocket library"
  , "keywords": ["WebSockets", "Server", "Ratchet", "Sockets"]
  , "homepage": "http://socketo.me"
  , "license": "MIT"
  , "authors": [
        {
            "name": "Chris Boden"
          , "email": "[email protected]"
          , "role": "Developer"
        }
    ]
  , "support": {
        "forum": "https://groups.google.com/forum/#!forum/ratchet-php"
      , "issues": "https://github.com/ratchetphp/Ratchet/issues"
      , "irc": "irc://irc.freenode.org/reactphp"
    }
  , "autoload": {
        "psr-0": {
            "Ratchet": "src"
        }
    }
  , "require": {
        "php": ">=5.3.9"
      , "react/socket": "0.3.*|0.4.*"
      , "guzzle/http": "~3.6"
      , "symfony/http-foundation": "~2.2"
      , "symfony/routing": "~2.2"
    }
}

What is wrong? Please give me a solution. Thanks in advance :)

Hardness answered 7/7, 2014 at 12:20 Comment(0)
R
19

Ok, here we go...

You must have ZMQ and ZMQ binding installed previously in operation system. 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 (or 5.4+, but I haven't tested yet...) 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

WOW!!! Now we gonna to update composer requirements:

~$ composer --verbose update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing react/zmq (v0.3.0)
    Downloading: 100%         
    Extracting archive

Writing lock file
Generating autoload files
Randa answered 7/7, 2014 at 13:28 Comment(0)
O
11

If you are still getting the same error even after following the above answer then it might be because of incorrect php.ini used usually by composer.
You have to update the ini of CLI PHP also.

If you run the command php --ini from inside your terminal then you should see something like following:

enter image description here

This .ini meant for different usage than /etc/php5/apache2/php.ini. So, update that /etc/php5/cli/php.ini and add extension=zmq.so in it, if you think you already installed the extension following a correct workflow.

Hope you will get rid off that the requested PHP extension zmq is missing error while using composer installation.

Ommiad answered 30/11, 2014 at 16:19 Comment(4)
You are a god among gods!!! That was all I needed after a half hour of trying to figure out what the heck was wrong. Thank you sooooo much.Swope
Pleasure & happy to hear that :)Ommiad
Yes! finally it all works. thanks for the extra tip!Menedez
I am not getting the cli list of php ini file.Brenna
Z
0

If you are using Xampp on windows, then follow these steps

  1. Download all dll here http://pecl.php.net/package/zmq to your matching OS. Make sure you got the right one (x86 or x64) and that it is either thread safe or non- thread safe. How would you know? Time to play DLL roulette.
  2. Copy libzmq.dll to your xampp/php/
  3. Copy php_zmq.dll to your php extension directory (eg. xampp/php/ext/)
  4. Then add this to your php.ini extension=php_zmq.dll
Zhang answered 28/5, 2020 at 12:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.