neildaemond Posted April 5, 2012 Share Posted April 5, 2012 My client got their web hosting from a terrible company who poses as IT consultants but really just act as middle men, reselling the cheap web hosting they purchase from a legitimate company... it is VERY frustrating. Anyways, my site won't load and gives the errors that it can't find the json_decode() function. I tried installing a fresh PW, and the checks gave the errors that json support and the php was slightly outdated. but in the end it installed, but got errors on load. same as when I load my pages. So, is there a way to hack pw so that it doesn't require json support? I tried asking the "IT Consultants" to install json, but they wouldn't. I even gave them the list of command that would do it for them. They obviously don't even have root access to their servers. so lame. Link to comment Share on other sites More sharing options...
Soma Posted April 5, 2012 Share Posted April 5, 2012 I don't think you want to take that route, as it is used by many things, mostly javascripts. Too much, if you ask me, to change. Not sure. Changing host is the best solution. Or maybe there's a workaround to implement that functionality using a class, but not even sure if that would work. Link to comment Share on other sites More sharing options...
Ben Posted April 5, 2012 Share Posted April 5, 2012 Coming from another angle, maybe you could include a replacement json_encode in the application? Just make sure it gets loaded in before it is called. Here are a couple alternatives for older PHP: http://snippets.dzone.com/posts/show/7487 http://www.boutell.com/scripts/jsonwrapper.html 1 Link to comment Share on other sites More sharing options...
diogo Posted April 5, 2012 Share Posted April 5, 2012 Ryan already answered to this on another thread. Here it is: http://processwire.c...r-json-support/ (last answer) Link to comment Share on other sites More sharing options...
neildaemond Posted April 7, 2012 Author Share Posted April 7, 2012 Thanks alot for your help guys. I added json support by mashing up two solutions from: http://www.epigroove.com/posts/97/how_to_use_json_in_php_4_or_php_51x http://techblog.willshouse.com/2009/06/12/using-json_encode-and-json_decode-in-php4/ Where from the first link, I got the nice script which I could place inside the ../core/Functions.php: if (!function_exists('json_decode')) { function json_decode($content, $assoc=false) { require_once 'classes/JSON.php'; if ($assoc) { $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); } else { $json = new Services_JSON; } return $json->decode($content); } } if (!function_exists('json_encode')) { function json_encode($content) { require_once 'classes/JSON.php'; $json = new Services_JSON; return $json->encode($content); } } just changing the 'require_once' to point at the JSON.php which I got from a link within the second solution(this way I didn't have to install pear, which I was unsuccessful doing): http://mike.teczno.com/JSON/JSON.phps I renamed JSON.phps to JSON.php ... so the json errors no longer appeared. HOWEVER, Since the host only uses php 5.19, I got many other errors. After Complaining to my 'web host', they just said they aren't responsible for third party software support. They will move me to another server which uses php 5.2.3, so hopefully things work out for that~ even though pw's requirement says 5.2.4 cross fingers~ Link to comment Share on other sites More sharing options...
ryan Posted April 9, 2012 Share Posted April 9, 2012 Neil, thanks for posting the JSON solution you used. Regarding PHP versions: not even WordPress will run in PHP prior to 5.2.4. Some big red flags at that web host… run away! 1 Link to comment Share on other sites More sharing options...
neildaemond Posted April 10, 2012 Author Share Posted April 10, 2012 Some big red flags at that web host… run away! I ran and decided to just host it on my own~ got them to point the A Records to my cloud server and spent the evening figuring out how to make virtualhosts 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now