Search code examples
phpmemcachedapcamazon-rdsmysqlnd

Error compiling mysqlnd_qc with apc


Running the command pecl install mysqlnd_qc to install the caching with APC enabled I receive the following error:

configure: error: APC is onlysupported if both APC and MySQL Query Cache are compiled statically
ERROR: `/var/tmp/mysqlnd_qc/configure --enable-mysqlnd-qc-apc=yes --enable-qc-memcache=no --enable-qc-sqlite=no' failed

Without the APC enabled it compiles fine...

PHP version: 5.3.17

Running on Amazon RDS.

What does it mean to compile APC and MySQL Query Cache statically?

How is it done?


Update 1:

As I haven't managed to compile mysqlnd_qc with APC, I tried compiling it with memcached. Here was an interesting issue. The ./configure command didn't recognize the the option the pecl gave for memcache. I found out that the option was entered incorrectly...

So I killed the pecl installation when it was asking for the options and ran the following commands myself:

sudo ./configure --enable-mysqlnd-qc-memcache --with-libmemcached-dir=/usr/
sudo make
sudo make install

So with memcached it now works.

If running on Fedora (I guess also RedHat and CentOS) there is available a rpm:

sudo yum install php-pecl-mysqlnd-qc

Update 2:

I managed to compile with APC, see the detailed answer below.


Solution

  • Well found the solution:

    Here is what I did:

    Get php 5.3.17:

    wget https://github.com/php/php-src/archive/PHP-5.3.17.zip
    unzip PHP-5.3.17.zip
    

    Get mysqlnd_qc:

    wget http://pecl.php.net/get/mysqlnd_qc-1.1.1.tgz
    tar -zxvf http://pecl.php.net/get/mysqlnd_qc-1.1.1.tgz
    mkdir -p php-src-PHP-5.3.17/ext/mysqlnd_qc
    cp -R mysqlnd_qc-1.1.1/* php-src-PHP-5.3.17/ext/mysqlnd_qc
    

    Get APC:

    wget http://pecl.php.net/get/APC-3.1.13.tgz
    tar -xzvf APC-3.1.13.tgz
    mkdir -p php-src-PHP-5.3.17/ext/apc
    cp -R APC-3.1.13/* php-src-PHP-5.3.17/ext/apc/
    

    Compile: (maybe don't need all on other systems)

    sudo yum install bison
    sudo yum install libxml2 libxml2-devel
    sudo yum install autoconf213
    sudo yum install httpd-devel
    sudo yum install bzip2 lbzip2 bzip2-libs bzip2-devel
    
    export PHP_AUTOCONF=/usr/bin/autoconf-2.13
    
    ./buildconf --force
    make clean && make
    

    (for me the linkage failed and had to add '-lpthread' to linkage)

    make test
    sudo make install
    

    I used also the following 2 commands but I don't remember for what and when...

    phpize
    aclocal
    

    Run the same ./configure as in phpinfo and add these options:

    --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-qc --enable-mysqlnd-qc-apc --enable-mysqlnd --enable-apc --enable-static=apc
    
    • All the --with must be replaced.