Date: Fri, 1 Feb 2019 10:24:49 -0500 From: Mark Moellering <markmoellering@psyberation.com> To: questions@freebsd.org Subject: Re: Problems with JSON and PHP Message-ID: <CAA0uU3XR4LMBdHzTFq0tmdHmKzpsSO9F_AuMoryBrTA0%2BG2%2BFw@mail.gmail.com> In-Reply-To: <BA63BD50-B678-4B72-82B3-8800E9C210F3@boosten.org> References: <C71BB378-7DC7-4C6B-83AE-21C44BA240EE@mail.sermon-archive.info> <CAA0uU3VJLXetWaeVr1CntGAnjFOyWQj0EyjB-W1ri3nJCHXeAA@mail.gmail.com> <BA63BD50-B678-4B72-82B3-8800E9C210F3@boosten.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 1, 2019 at 10:17 AM <freebsd@boosten.org> wrote: > >> test# more /usr/local/www/apache24/data/test.php > >> <?php > >> print "Hello world"; > >> > >> $myObj =3D (object) array(); > >> $myObj->name =3D "John"; > >> $myObj->age =3D 30; > >> $myObj->city =3D "New York"; > >> > >> $myJSON =3D json_encode($myObj); > >> > >> echo $myJSON; > >> ?> > >> > >> > >> I use php and my biggest complaint is the way it handles errors. I > think > > what is happening is that your Object Definition has a syntax error but > php > > is complaining about the json_encode. > > I believe (from the php.net docs) that it should be > > > > $myObj =3D new stdClass(); > >> $myObj->name =3D "John"; > >> $myObj->age =3D 30; > >> $myObj->city =3D "New York"; > >> > > > > Don=E2=80=99t believe that=E2=80=99s actually the issue, since the suppli= ed test.php works > like charm for me, either in my browser (through apache) or via command > line. > > If it were the declaration, the command line would fail as well. > > Peter > There you go, injecting logic. The only other thing I can think of is check the FPM php.ini file. What happens if you try a simple json_encode of a string? Try the simplest call first, then go on from there.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAA0uU3XR4LMBdHzTFq0tmdHmKzpsSO9F_AuMoryBrTA0%2BG2%2BFw>