2

We're running CentOS 6 and PHP 5.3.8 (as an apache module) which should have JSON as part of it's core (I'm told). Looking at # php -i on the command line I can see under Configure Command '--enable-json=shared' ... great!

However, looking at php_info() on a web page Configure Command shows '--disable-json'.

No problem I thought, I'll just install it using pecl:

# yum update php
# yum install php-pear
# yum install gcc
# pecl install json
# service httpd restart

Success, that aught to do it I thought. However php -m shows:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/json.so' - /usr/lib64/php/modules/json.so: undefined symbol: ZVAL_DELREF in Unknown on line 0

Apologies if this is a silly question but does anyone know what's going on here and could you point me in the right direction on how to fix this so that JSON starts working?

Many thanks

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
BrochanGuMor
  • 710
  • 1
  • 9
  • 16
  • 2
    Have you considered recompiling PHP with JSON enabled? That doesn't make much sense to be disabled explicitly as it is a core module. – Rudi Visser Nov 02 '11 at 11:58
  • Hello Rudi, so is the command line PHP different to mod_php? Both appear to be running the same version of PHP although one has --enable-json=shared and the other --disable-json. Not sure what that means. I haven't recompiled PHP before and I don't want to break anything (it's a live server). Is recompiling easy if I just want to remove the '--disable-json' flag? – BrochanGuMor Nov 02 '11 at 13:01

3 Answers3

4

Thought I'd follow up with the solution. The PECL installation seemed to conflict with PHP 5.3.8 so after a bit of research and some advice I toyed with the idea of:

# yum remove php
# yum install php

However, after further advice instead went with:

# yumdownloader php-common
# rpm -Uvh --force php-common*.rpm
# service httpd reload
# rm php-common*.rpm

This did the trick and JSON is now working again. Hope this helps someone else.

Thanks

BrochanGuMor
  • 710
  • 1
  • 9
  • 16
2

download json-1.2.1.tgz FROM PECL

enter code heretar zxvf json-1.2.1.tgz
cd json-1.2.1
vi JSON_parser.c

Find ZVAL_DELREF replace to Z_DELREF_P (You can Find in 3 place) And Save file

Then

phpize
./configure
make
make install

You can get your json.so don't forget add to php.ini

Wahyu Kristianto
  • 8,719
  • 6
  • 43
  • 68
Star
  • 21
  • 1
  • There is also `function_entry` you have to change to `zend_function_entry` in file `json.c`. [Package php5-json breaks firephp](http://unix.stackexchange.com/questions/87067/package-php5-json-breaks-firephp) – sumid Mar 24 '14 at 23:15
1
  1. Login to SSH
  2. Make tmp and var/tmp exec

    mount -v -o remount,exec /tmp
    mount -v -o remount,exec /var/tmp

  3. No go ahead and install JSON

    pecl install json

  4. And finally, make tmp and var/tmp noexec again

    mount -v -o remount,noexec /tmp
    mount -v -o remount,noexec /var/tmp

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
Admin
  • 11
  • 1
  • SSH into what? Given the context of the question, this answer makes little sense. – Axle Jul 15 '14 at 15:45
  • Agree with Axle, this makes very little sense. Why need to mount? What is being mounted? – a20 Oct 14 '15 at 07:01