2

I have tried to install php5-mod-json, but it did not help. I would prefer a solution without any other frameworks. PHP version that I am running is 5.4.5 Also I am using nginx and OpenWRT

Thank you in advance.

  • 5
    possible duplicate of [PHP Fatal error: Call to undefined function json\_decode()](http://stackoverflow.com/questions/18239405/php-fatal-error-call-to-undefined-function-json-decode) – GiamPy Aug 25 '15 at 12:27
  • 1
    This is not duplicate... The platform is 'embedded' where its is running under OpenWRT as I can see. The solution in the link is for workstation running Ubuntu. I am also looking for the json package for OpenWRT which can solve this issue. I am unable to find it through `opkg` package manager. – Muneer Oct 22 '15 at 08:10

1 Answers1

1

I tried installing the php5-mod-json. It is working fine for me.

opkg install php5-mod-json

if it doesn't work for you, you need to add the URL http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/oldpackages in your package list.

// File content 'index.php'
echo json_encode(array('ok'));

Test

root@openWRT:/www/html# php-cli index.php 
["ok"]
Muneer
  • 7,384
  • 7
  • 38
  • 62