Let’s Install JSON for PHP 5
2010-04-27 13:18
281 查看
I recently started messing around with building my own Facebook application. I figured the best way to start learning was to download the demo application and get it working on the Slaptijack web server. I quickly ran into a problem:
The problem is that PHP 5.2 includes the
Install json – This was actually trickier than expected. I assumed I would be able to install this via
Add
Restart Apache – Not much more to add here. Without the restart, the extension won’t be loaded.
Profit!
That’s all it took. Now my PHP 5 installation is kicking along happily with the required JSON functions.
http://slaptijack.com/system-administration/lets-install-json-for-php-5/
PHP Fatal error: Call to undefined function json_encode()
The problem is that PHP 5.2 includes the
json_encode()and
json_decode()functions built right in. Unfortunately, I’m running on PHP 5.0 which doesn’t include native JSON support. Here’s how I resolved that.
Install json – This was actually trickier than expected. I assumed I would be able to install this via
pear. Apparently, a PEAR Services_JSON package was developed, but it has never been accepted into the official repository. The trick instead is to use the PECL json package. This was as easy as running
pecl install jsonand watching the compiler do its thing. When it’s done you should have a
json.sofile in your PHP modules directory. (Mine is
/usr/lib/php/modules/.)
Add
json.inifile to
/etc/php.d/– This file is pretty simple. Simply add
extension=json.soto this file and that will enable the extension.
Restart Apache – Not much more to add here. Without the restart, the extension won’t be loaded.
Profit!
That’s all it took. Now my PHP 5 installation is kicking along happily with the required JSON functions.
http://slaptijack.com/system-administration/lets-install-json-for-php-5/
相关文章推荐
- nginx,php for window 7(64bit) install
- Install MongoDB driver for PHP on XAMPP for Mac OSX
- How to add / install JSON support to PHP on CentOS in 10 Steps
- How to Install mcrypt for php on Mac OSX Lion 10.8 & 10.7 Development Server
- APACHE+MYSQL+PHP FOR LINUX INSTALL SHELL
- Install JSON PHP Extension on CentOs / RedHat
- Howto: install phplua extension for PHP
- How to Install CURL library for PHP in Ubuntu box
- How to install Microsoft's SQL Server Driver for PHP
- Install mcrypt for php on Mac OSX 10.10 Yosemite for a Development Server
- Centos install ICU, INTL for php
- install php wrapper for imagemagick
- nginx,php for window 7(64bit) install
- php composer.phar install error The openssl extension is required for SSL/TLS protection
- How to install HipHop for PHP on CentOS 5.x
- install composer for php 7 on CentOS 7
- install sphinx for php on ubuntu
- PHP pcel install for Debian
- Install mcrypt for php on Mac OSX 10.10 Yosemite for a Development Server
- ubuntu install curl for php 5