正在为 MAMP 上的 Cassandra 安装 PHP 驱动程序

Installing PHP driver for Cassandra on MAMP

我 运行 PHP 5.5.22 通过 MAMP (pro) 在 OSX 10.10.4 我只想使用 PHP 与 Cassandra 一起工作(运行 本地)。

Datastax 似乎是 Cassandra 世界的大人物。所以我假设我需要安装这个驱动程序:https://github.com/datastax/php-driver/ via these instructions: https://github.com/datastax/php-driver/blob/master/ext/README.md 但它们对我来说毫无意义。

如何加载我的 cassandra.so 模块?

好的,就这样开始吧:

首先,我必须让我的 php 在 MAMP 上配置适当的 php 源,该源不随 MAMP

一起提供
  1. 我在 MAMP 上更改为最新的 PHP 版本,对我来说是 5.6.10,还将我的 PATH 变量更改为 php 的新 bin:/Applications/MAMP/bin/php/php5.6.10/bin/
  2. 下载了 php 5.6.10 源代码,将其解压缩并将文件夹重命名为“php
  3. 导航到 /Applications/MAMP/bin/php/php5.6.10 并创建了一个名为“include”的目录 - 将下载的 php 文件夹复制到那里
  4. cd /Applications/MAMP/bin/php/php5.6.10/include/php 和 运行 ./configure

然后按照此处的说明进行操作:https://github.com/datastax/php-driver/blob/master/ext/README.md

  1. 在终端中,运行:brew install libuv cmake gmp
  2. 在有意义的目录中,运行 :

git clone https://github.com/datastax/php-driver.git cd php-driver git submodule update --init cd ext ./install.sh phpize ./configure make install

然后编辑php.ini加入:extension=cassandra.so