Tuesday, September 4, 2012

Upgrade PHP 5.1/5.2 to 5.3 on CentOS

To upgrade from 5.2 to PHP 5.3
1.  used the yum commands list command to quickly get this information:
2. yum search php53 | cut -d' ' -f1 | grep php
3. First, shut down the Apache server as I didn’t want people going to broken pages as I did these updates:
     service httpd stop
4. Next, remove the old PHP packages:
 yum remove php php-cli php-common php-devel php-gd php-mbstring \
5. Finally,  installed the available replacement packages:
 yum install php53 php53-cli php53-common php53-devel php53-gd \

6. Install PHP mcrypt
Need to install the development package for mcrypt
      yum install php53-devel libmcrypt-devel
wget http://museum.php.net/php5/php-5.3.3.tar.gz
tar xf php-5.3.3.tar.gz
cd php-5.3.3/ext/mcrypt/
phpize
./configure
make
make test
make install
echo -e "; Enable mcrypt extension module\nextension=mcrypt.so" | \
wget http://pear.php.net/go-pear.phar
php go-pear.phar
PHP 5.3 now requires that you either have a timezone set in your php.ini file or that you pass the desired timezone via the date_default_timezone_set() function before calling the date() function.
I opened my server’s /etc/php.ini file and searched for timezone. My ini file had a section like the following:
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
; date.timezone =
I uncommented the date.timezone line and added the timezone I wanted.
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = 'America/Chicago'
There are two very important things to do in order for this to work properly for you:
    Use a timezone that is appropriate for your needs. Use PHP’s List of Supported Timezones to find the timezone that works for you.
    Since your server is likely to cache the PHP configuration, you will want to restart your web server process in order for the change to be recognized. The command to execute varies by system, but for most systems, the following will work:
    [user@server /etc]$ sudo service httpd restart
    [sudo] password for user:
    Stopping httpd:                                            [  OK  ]
    Starting httpd:                                            [  OK  ]
    [user@server /etc]$
 
Installing from repositoty
Fr. terminal

# wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
$wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
#ls
#rpm -ivh epel-release-5-4.noarch.rpm
#rpm -ivh remi-release-5.rpm

#yum remove php* (existing php)
#yum install php php-cli php-gd php-mysql php-mbstring php-pear enable=remi


Reference:
http://chrisjean.com/2011/06/24/upgrade-php-5-1-or-5-2-to-5-3-on-centos/

TIMEZONE ISSUE
http://chrisjean.com/2011/06/24/php-5-3-and-system-timezone-settings/

TO TEST THE CNF PERFORMANCE
http://www.omh.cc/mycnf/


No comments:

Post a Comment

SEO TOOLS

Check Page Rank of your Web site pages instantly:

This page rank checking tool is powered by Page Rank Checker service