php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59267 undefined symbol: php_json_encode in Unknown on line 0
Submitted: 2010-06-16 16:06 UTC Modified: 2011-03-20 11:25 UTC
From: ben at visionsource dot org Assigned:
Status: Closed Package: memcached (PECL)
PHP Version: 5.2.13 OS: RedHat
Private report: No CVE-ID:
 [2010-06-16 16:06 UTC] ben at visionsource dot org
Description:
------------
When ever I compile memcached, receive this error with make test:

Warning: PHP Startup: Unable to load dynamic library '/home/***/memcached-1.0.2/modules/memcached.so' - /home/*****/memcached-1.0.2/modules/memcached.so: undefined symbol: php_json_encode in Unknown on line 0


=====================================================================
PHP         : /usr/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 5.2.13
ZEND_VERSION: 2.2.0
PHP_OS      : Linux - Linux ****** 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:31 EST 2010 i686
INI actual  : /home/******/memcached-1.0.2/tmp-php.ini
More .INIs  :  
CWD         : /home/****/memcached-1.0.2
Extra dirs  : 
VALGRIND    : Not used



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-16 16:19 UTC] andrei@php.net
I think 5.3 is required for memcached 1.0.2.
 [2010-06-16 16:31 UTC] ben at visionsource dot org
In the summary page it says 5.2:

PHP Version: PHP version 6.0.0 or older
PHP Version: PHP 5.2.0 or newer
PEAR Package: PEAR Installer 1.4.0b1 or newer
 [2011-03-17 15:51 UTC] steve dot fortin at cogecodiffusion dot com
I have the same issue with redhat / php 5.2.x
 [2011-03-20 10:02 UTC] admin at mytravelog dot org
The same issue on Amazon Linux AMI 2011.02.1 beta x32 with yum'ed PHP 5.3.5

Memcache extension works fine, but MemcacheD cant be loaded due to "undefined symbol: php_json_encode in Unknown on line 0"

Here is the installation sequence:

yum install memcached
cd /usr/local/src
wget http://launchpad.net/libmemcached/1.0/0.48/+download/libmemcached-0.48.tar.gz
tar zxvf libmemcached-0.48.tar.gz
cd libmemcached-0.48
./configure --disable-64bit CFLAGS="-O3 -march=i686"
make && make install
pecl install memcached

-------
then add extension=memcached.so and double check, that json.so is enabled and is visible by phpinfo();
 [2011-03-20 10:23 UTC] admin at mytravelog dot org
I have just found a solution for this bug.

Just make sure that extension=json.so is specified BEFORE extension=memcached.so.

I had placed extension=memcached.so in php.ini, and extension=json.so was specified in /etc/php.d/json.ini, that is parsed AFTER php.ini. That is why PHP can't find php_json_encode() at the point of loading memcached.so.

I guess, this info should better be added to the installation instructions. I have seen a lot of complaints on this bug all over the Web.

Cheers! Thanks for the nice extension!
 [2011-03-20 11:25 UTC] andrei@php.net
Please try php-memcached-2.0.0b1, it has this issue fixed.
 [2012-08-10 18:41 UTC] kevin dot seelbach at gmail dot com
I had this same problem, but found that the fix is as simple as removing the extension declaration from php.ini, and letting php.ini load the preexisting json.so and memcached.so in /etc/php.d/. I'm on EC2 Linux (CentOS, I think?).
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 16:02:23 2014 UTC