开发者

PHP JSON. Confusing issue

Ok I am running CentOS, with PHP 5.2. I recently added the JSON extension. When running

php -i

.. after installing JSON, it says

json

json support => enabled
json ver开发者_JS百科sion => 1.2.1

But when I run phpinfo it's not showing the JSON extension as being enabled. I have added the extension to the php.ini file so it loads the json.so file.

I am so confused about this. What could the possible causes of this be?

btw. I am running php as an apache module.


Probably your PHP cli is using a different php.ini file, one that loads the json extension, and the Apache module isn't. php -i and phpinfo() give information about the loaded php.ini files.

For PHP cli, the php.ini location can be specified through the PHPRC environment variable or with php -c <file|dir>. For the Apache module, you can use the Apache directive PHPINIDir.


As of PHP 5.2 the JSON extension is included in the core, you don't need to include any extensions. If it says JSON support is enabled it should work. Have you actually tried it?

As long as php wasn't compiled with --disable-json.


Solved it guys. I added an updated repository, and ran yum update php I made the wrong mistake of assuming I was using 5.2 when infact it was 5.1

After the update it worked.


addition :

The solution is:

cd /usr/lib/php/modules (or your modules directory where the json.so file is)

strip json.so

apachectl restart

source : http://fanaticalwebworker.blogspot.com/2010/10/json-with-apache-centos-44-and-php-516.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜