JSON support for PHP???

Support/Development for PHP
redpaint
Forum Regular
Forum Regular
Posts: 101
Joined: Mon Oct 31, 2011 11:47 am
Location: UK

JSON support for PHP???

Unread post by redpaint »

Hello,

Quite new to this, can anyone tell me how to configure JSON support for PHP on a CentOS 6 system running ART 3?

./configure is showing "--disable-json" on phpinfo() when PHP is running as an Apache module. It seems to have "--enable-json=shared" when running as Fast-CGI??

Not sure where to start or how to get round this. I've tried installing JSON through pecl but that doesn't work as it comes back with

Code: Select all

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
so I've uninstalled that and removed the json.ini file from /etc/php.d/.

I'm a bit stuck really and not sure where to go, seems that I'm going in circles as almost all JSON tutorials point me to install via PECL but that doesn't seem to work. I haven't recompiled PHP before and this is a live server so I'm nervous about bringing the whole thing to a grinding halt and would love some guidance.

Thank you in advance
Andy
redpaint
Forum Regular
Forum Regular
Posts: 101
Joined: Mon Oct 31, 2011 11:47 am
Location: UK

Re: JSON support for PHP???

Unread post by redpaint »

This is the error I'm getting when installing json through pecl

Code: Select all

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
And the only reference to this I've found is here http://forums.famillecollet.com/viewtopic.php?id=76

Any thoughts?
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4149
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: JSON support for PHP???

Unread post by mikeshinn »

Which PHP rpm do you have installed?
redpaint
Forum Regular
Forum Regular
Posts: 101
Joined: Mon Oct 31, 2011 11:47 am
Location: UK

Re: JSON support for PHP???

Unread post by redpaint »

Hello Mike,

Code: Select all

 rpm -qa | less | grep php
shows the following:

Code: Select all

roadsend-php-libs-2.9.8-10.2.el6.art.x86_64
asl-php-common-5.2.17-1.el6.art.x86_64
asl-php-mysql-5.2.17-1.el6.art.x86_64
php-common-5.3.8-2.el6.art.x86_64
php-mysql-5.3.8-2.el6.art.x86_64
php-xml-5.3.8-2.el6.art.x86_64
php-pear-1.9.0-2.el6.noarch
asl-php-pdo-5.2.17-1.el6.art.x86_64
asl-php-gd-5.2.17-1.el6.art.x86_64
php-ioncube-loader-4.0.10-1.el6.art.x86_64
php-pdo-5.3.8-2.el6.art.x86_64
php-gd-5.3.8-2.el6.art.x86_64
php-mbstring-5.3.8-2.el6.art.x86_64
php-zend-guard-loader-5.5.0-3.el6.art.x86_64
asl-php-5.2.17-1.el6.art.x86_64
php-5.3.8-2.el6.art.x86_64
php-imap-5.3.8-2.el6.art.x86_64
php-soap-5.3.8-2.el6.art.x86_64
php-eaccelerator-5.3.8_0.9.6.1-1.el6.art.x86_64
asl-php-cli-5.2.17-1.el6.art.x86_64
psa-php5-configurator-1.6.1-rhel6.build1012110525.15.x86_64
php-cli-5.3.8-2.el6.art.x86_64
php-devel-5.3.8-2.el6.art.x86_64
php-mcrypt-5.3.8-2.el6.art.x86_64
Your help is very much appreciated.

Many thanks
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4149
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: JSON support for PHP???

Unread post by mikeshinn »

OK, thank you. Can you confirm that the .so is from those rpms?

And if so, have you tried downloading the src rpm for 5.3.8 from the atomic repo and building it for your needs from there?
redpaint
Forum Regular
Forum Regular
Posts: 101
Joined: Mon Oct 31, 2011 11:47 am
Location: UK

Re: JSON support for PHP???

Unread post by redpaint »

Hello Michael,

This is what I did:

Code: Select all

# yum update php
# yum install php-pear
# yum install gcc
# pecl install json
# service httpd restart
Not quite sure where the .so is coming from in this case.

I haven't tried rebuilding the rpm for 5.3.8; I wouldn't know where to start as I haven't rebuilt from an rpm before and I wouldn't want to break anything.

Can you tell me then if the 5.3.8 coming from ASL has --disable-json configured by default? If so could that decision be re-considered given that JSON is part of PHP 5.2 and that many open source platforms require encrypt_json and decrypt_json e.g. wordpress? Is it a security risk to have it enabled by default?

Thanks
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4149
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: JSON support for PHP???

Unread post by mikeshinn »

json.so is already included in 5.3.8, you may have overwritten it with the pecl install.

[root@asl-modsec-test ~]# rpm -qf /usr/lib64/php/modules/json.so
php-common-5.3.8-2.el5.art

What happens if you do a clean install of PHP?
redpaint
Forum Regular
Forum Regular
Posts: 101
Joined: Mon Oct 31, 2011 11:47 am
Location: UK

Re: JSON support for PHP???

Unread post by redpaint »

Hello Mike,

I get the same:
# rpm -qf /usr/lib64/php/modules/json.so
php-common-5.3.8-2.el6.art.x86_64
How do I do a clean install or remove any instances of the pecl installation? I've done a pecl uninstall.

There isn't a file located at /usr/lib64/php/modules/json.so but I can see a similar looking file at /var/asl/usr/lib64/php/modules/json.so should I copy /var/asl/usr/lib64/php/modules/json.so to /usr/lib64/php/modules/json.so?

Alternatively can you tell me how I do a clean install of PHP? Quite new to this (sorry).

Many thanks
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4149
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: JSON support for PHP???

Unread post by mikeshinn »

Sure, no problem. So the easy way is to just do a "yum remove php" and then do a "yum install php".
/var/asl/usr/lib64/php/modules/json.so should I copy /var/asl/usr/lib64/php/modules/json.so to /usr/lib64/php/modules/json.so?
No dont do that. Thats for the ASL GUI, its got its own PHP install that doesnt have anything to do with the OS. You dont want to use those shared objects.
redpaint
Forum Regular
Forum Regular
Posts: 101
Joined: Mon Oct 31, 2011 11:47 am
Location: UK

Re: JSON support for PHP???

Unread post by redpaint »

Many thanks Mike,

Sorry to be pedantic, but it's a live server and I've been thrown in at the deep end a little. We're looking for a server admin to assist but right now it's just me.

If I do a "yum remove php" and "yum install php" and if the yum repositories are unchanged from the ones Plesk and ASL what's the possibility/likelyhood this might break Plesk or the webserver? I realise you can't give me an definite answer and I won't hold you to it but is this 99% likely to work without any problems or is it more like 50-50?

Just a little paranoid and I'm stuck between a rock and a hard place with a requirement to get JSON working and the potential horror that the server may roll over and die.

Thanks in advance.
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4149
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: JSON support for PHP???

Unread post by mikeshinn »

Well, on a live server thats going to disable PHP during the reinstall (which will break any PHP apps temporarily). I had to guess, Plesk likely has PHP as a dependency so uninstalling PHP may also try to uninstall some of Plesk.

One way to find out is to run the command, and when asked if you want to continue say no and post the output here. If its just PHP thats being removed, then the impact would only be (temporarily) on PHP applications.
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: JSON support for PHP???

Unread post by breun »

I suggest downloading the php-common package (which contains the json extension) and reinstalling that, which should overwrite json.so with the good file.

Something like this:

Code: Select all

yumdownloader php-common
rpm -Uvh --force php-common*.rpm
service httpd reload
rm php-common*.rpm
(Hey, my signature mentions a company that can manage servers for you!)
Lemonbit Internet Dedicated Server Management
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4149
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: JSON support for PHP???

Unread post by mikeshinn »

Yep, that will do as well.
redpaint
Forum Regular
Forum Regular
Posts: 101
Joined: Mon Oct 31, 2011 11:47 am
Location: UK

Re: JSON support for PHP???

Unread post by redpaint »

Hello both,

I had to install yum-utils to get yumdownloader to work. It downloads the following files:
php-common-5.3.8-2.el6.art.i686.rpm
php-common-5.3.8-2.el6.art.x86_64.rpm
Are these both to be run using
rpm -Uvh --force php-common*.rpm
or should I just be running
rpm -Uvh --force php-common-5.3.8-2.el6.art.x86_64.rpm
Thanks again for your help, I really really appreciate it.
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: JSON support for PHP???

Unread post by breun »

You probably only need the 64-bit package. I guess you also have only the 64-bit versions installed of the other PHP packages.
Lemonbit Internet Dedicated Server Management
Post Reply