drm16022 2014-09-30 14:18
浏览 48

Docker容器中的Couchbase PHP SDK

I have a Docker container that runs PHP-FPM 5.5 and I'd like to ensure that it has access to the Couchbase SDK. I have this working outside of Docker and can't really picture how Docker would interfere and yet I seem to be running into a problem that is "probably" docker related:

My Docker container runs under Ubuntu 14.04 and includes the following installation (after installing PHP):

# Install Couchbase C-library and PECL extension
RUN wget -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1404.list \
        && wget -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add - \
        && apt-get update \
        && apt-get install -y --no-install-recommends pkg-config libcouchbase2-libevent libcouchbase-dev libmemcached-dev php-pear php5-dev make \
        && pecl config-set php_ini /app/conf/php.ini \
        && pecl install couchbase --alldeps \
        && pecl install memcached --alldeps \
        && { \
            echo "; Couchbase PHP SDK"; \
            echo "extension=/usr/lib/php5/20121212/couchbase.so"; \
        } > /etc/php5/fpm/conf.d/30-couchbase.ini \
        && cp /etc/php5/fpm/conf.d/30-couchbase.ini /etc/php5/cli/conf.d \
        && { \
            echo "; Memcached PHP SDK"; \
            echo "extension=/usr/lib/php5/20121212/memcached.so"; \
        } > /etc/php5/fpm/conf.d/30-memcached.ini \
        && cp /etc/php5/fpm/conf.d/30-memcached.ini /etc/php5/cli/conf.d

This SHOULD install both the C-libraries and the PECL extensions for Couchbase and Memcached support. In many ways it DOES appear to:

  • php -m does include these modules as installed,
  • and phpinfo() reports on their configuration as such:



However, whenever I try to instantiate either a Couchbase or Memcached class can't find the class. So if I run the following program:

    $foo = new Couchbase();
    $bar = new Memcached();

it gives me the following error:

PHP Fatal error: Class 'Couchbase' not found in /app/test.php on line 2

UPDATE: It turns out, however, that while Couchbase does not work, Memcached does. Not sure if that helps or hurts the troubleshooting but Couchbase seems to be the exclusive pain point.

  • 写回答



      相关推荐 更多相似问题


      • ¥15 模型导入SP后贴图纹理只有一个,拆了四张UV的,怎么解决?
      • ¥15 检索带order by 非常慢
      • ¥20 python 爬虫 token 加密方式
      • ¥20 IAR环境报错reading CPU status failed
      • ¥15 数组问题,刚学C语言
      • ¥20 Python如何读取指定播放设备的音频帧?
      • ¥15 用dnspy修改游戏数据报错
      • ¥15 关于unity打包成webgl后页面上不显示服务端接收到的数据的问题
      • ¥16 (大一)有偿 想学会 excel数据处理和分析🥹
      • ¥15 matlab导入工具箱提示:此类型的变量不支持使用点进行索引错误