Here is a simple steps to install JSON for PHP in *nix server. The sample command below are running under Centos OS.

yum update "*php*"

Make sure you have install PHP Pear.
yum install php-pear

and The pecl command can then be found at /usr/bin/pecl

Then, we can start install PHP JSON.
pecl install json
cd /etc/php.d/
echo “extension=json.so” >> json.ini
service httpd restart

If you are using JQuery with JSON, take a look at this JQuery Json Library. Easy to use and simple.

ImageMagick PDF to Image conversion or Vice versa

Using Linux version of ImageMagick to convert PDF to Image

convert -density 140 test.pdf -resize 25% -quality 100 -colors 256 test.png

You can even use PHP ImageMagick library to convert pdf to image file.

For more information can be view from here :

Allow Apache PHP to access Unix Command or software.

Recently i was working with ImageMagick software (Open Source), basically a very powerful image suite to create, edit, and compose bitmap images. It can manipulate any sort of image just by using command line. Image using Photoshop with command line.

But calling an ImageMagick command using PHP Web pages required some configuration in the visudo files. Apparently, by default unix os will restrict any call or process that do not have any permission to access the internal command. If you wish to execute ImageMagick, you either required to use root user or user who is allowed externally to access the command. One of the way is to enable apache user, remove the Required TTY with visudo and add this to line into visudo (APACHE ALL = (ALL) NOPASSWD). I won’t say this is the only way, but this is one of the most easier. You can either use the PHP ImageMagick library or create and assign a group for apache that are only allowed it to access certain thing in the unix.

But the problem with using ImageMagick PHP library packages is that you can’t have much flexibility and control compare of using the command line.

THIS STEPS BELOW ARE NOT RECOMMENDED IF YOU DO NOT WANT TO RISK YOUR WEB SERVER.THIS SOLUTION ARE ONLY FOR TEMPORARILY RELIEVED UNTIL YOU FOUND A SAFER SOLUTION.

1. Open up your sudo configuration using visudo command.
2. Find the line Required TTY and comment it out using #Required TTY
3. Add another line that remove required password when apache trying to use the command. : APACHE ALL = (ALL) NOPASSWD
4. Restart your apache and you are done with service httpd restart. Check your apache error log if you still can’t run the command to access ImageMagick.

Here are the list of ImageMagick PHP Packages :
———————————————-
MagickWand for PHP (PHP)
IMagick (PHP)

Launching Ecomjunction.com

Finally after several months of planning, handwork, and delay with my founder Arya. We finally launched our PayPal Payment Integration on 15/May/2010 with any website that wish to use PayPal as one of their paying methods. We also offer other services such as CMS management, Wed design and development, Usability and SEO advice, and as well as limited free services for non-profit organisation. Check out the web site at Ecomjunction.com

Malaysia BarCampKl 2010 April 24-25 is here.

BarCampKL 2010

Have been waiting BarcampKl for a while since i went back to Malaysia. As mention before in the previous post, BarCampKl is almost the same as BarCamp Melbourne which held in an un-conference way of events. There are no specifics schedule for any topics.

On the day itself, the topics will be posted on the wall and people can choose to attend and discuss together. If one of the audience is not interested, he/she can freely leave the room in order to respect the presenter rather to sit there uncomfortable.

Anyway, this time the BarCampKL 2010 will be held in Segi College Subang on 24 April – 25 April 2010. (Sat and Sun). For more information, you can visit their official blog. BarCamp KL. Can’t wait for the day.