Friday, October 30, 2009

Installing php 5.2.9

In CentOS, if you do

php --version

you will get it as 5.1.x

But if you are planing to use zend search lucene (http://www.zend.com/community/downloads and look for Zend Framework 1.9 minimal) or any of other zend packages, system requirements shows you need 5.2.4 or higher.

So how to upgrade php to 5.2.9 in centos 5?

Best Method:

http://www.freshblurbs.com/install-php-5-2-centos-5-2-using-yum#comment-403

The solution presented by "Great" on the above link is the perfect one.

This is what he says,

All, we need to do is create /etc/yum.repos.d/CentOS-test.repo and enter following lines in it:

[c5-testing]
name=CentOS-5 Testing 
baseurl=http://dev.centos.org/centos/5/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

Once done, just type

yum upgrade php

and you are good to go. Upon completion, the php is upgraded to 5.2.9

Others methods are:

(1)
One way to do so is http://www.atomicorp.com/wiki/index.php/PHP using yum.

But it did not work out for me, so I tried,

(2)
# wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
# tar xzvf libxml2-2.7.3.tar.gz
# cd libxml2-2.7.3
# ./configure
# make
# su -c “make install”


# wget http://uk2.php.net/get/php-5.2.9.tar.gz/from/uk.php.net/mirror
# tar zxvf php-5.2.9.tar.gz
# cd php-5.2.9
# ./configure –enable-soap
# make
# su -c “make install”


I took this solution from, http://imthi.com/blog/linux/install-or-update-php-5-on-centos.php#comment-28316 given by Brent.

It worked for me. after doing the above steps, when I did,

php --version

on command prompt. It should show, 5.2.9. But on apache, doing phpinfo() it showed 5.1.6 So the answer lies in PHPIniDir line in httpd.conf. Just need to add PHPIniDir "path/to/php" in httpd.conf.

Restart apache and system and enjoy !

Monday, October 26, 2009

Zend Lucene and Php

Zend Lucene is a powerful open source search engine. Couple of years ago, they extended their support to PHP. However, if you want zend lucene to work with Php, you will need PHP 5.0 Php 4 will not work.

Below are a few links to get you started.

http://www.phpriot.com/articles/zend-search-lucene

http://ganeshhs.com/zend-framework/zend-search-lucene-part1

http://framework.zend.com/manual/en/zend.search.lucene.html (complete guide)

Feel free to post any questions in comment section.

Saturday, October 24, 2009

Php and Design Pattern

Design Patterns are mostly studied while Java programming. However, now is not the case. With introduction of PHP 5 and its MVC (Model-View-Controller) structure. We can use Design Pattern with PHP too.

Below are few links which I found helpful in understanding Design Pattern in PHP.

http://sourcemaking.com/design_patterns

http://www.tonymarston.net/php-mysql/design-patterns.html

http://www.fluffycat.com/PHP-Design-Patterns/

http://www.ibm.com/developerworks/library/os-php-designptrns/

Feel free to ask any questions by posting in comments section.