Tuesday, August 9, 2011

Upgrade PHP5.1 to PHP5.2 on CentOs 5.6


PHP Upgrade

# rpm -qa |grep php

 php-common-5.1.6-15.el5.i386
 php-cli-5.1.6-15.el5.i386
 php-5.1.6-15.el5.i386
 php-pdo-5.1.6-15.el5.i386
 php-bcmath-5.1.6-15.el5.i386
 php-ldap-5.1.6-15.el5.i386
 php-devel-5.1.6-15.el5.i386
 php-gd-5.1.6-15.el5.i386
 php-xml-5.1.6-15.el5.i386
 php-mbstring-5.1.6-15.el5.i386
 php-mysql-5.1.6-15.el5.i386
 php-dba-5.1.6-15.el5.i386

As long as you're using the standard PHP packages on your CentOS server you won't need to do anything extra. If you're using extra PHP packages that aren't part of the standard CentOS repositories (like php-mcrypt) you'll have to remove them or find updated versions of them.

Add the development repositories

First thing we need to do is add the development repositories to yum. When we add the development repository we're going to configure it so it only pulls PHP packages. To start we'll need create a new yum repository configuration file (use your favorite editor):

 # /etc/yum.repos.d/CentOS-Testing.repo

Copy/paste the following into this file:

  # CentOS-Testing:
  # !!!! CAUTION !!!!
  # This repository is a proving grounds for packages on their way to CentOSPlus and CentOS Extras.
  # They may or may not replace core CentOS packages, and are not guaranteed to function properly.
  # These packages build and install, but are waiting for feedback from testers as to
  # functionality and stability. Packages in this repository will come and go during the
  # development period, so it should not be left enabled or used on production systems without due
  # consideration.
  [c5-testing]
  name=CentOS-5 Testing
  baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
  enabled=1
  gpgcheck=1
  gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
  includepkgs=php*

Make sure to remove any spaces at the start of each line, then save and close the file and you're done.

Update PHP packages

Before updating your PHP packages you'll want to get a list of what you currently have installed. To get a list of current PHP packages run the following:

 # rpm -qa |grep php

Now you can use yum to update the PHP packages on your system:

 # yum update

You should be shown a list of packages that are going to be updated. Compare it to the list of PHP packages on your system. Note any packages that are not in the list. You'll need to remove these packages or find updates for them because they won't work after you update to PHP 5.2.x. If that is acceptable type "y" to continue and let yum update the packages.

Once yum has completed restart Apache:

 # service httpd restart

To verify the update is working create a simple testing.php in your www directory with the following source code:

<?php
  phpinfo();
?>

and open it in a web browser. The new PHP version should be reflected at the top of the page.

Conclusion

You should now have PHP 5.2.6 running on CentOS 5.3 32-bit.

 # rpm -qa |grep php

  php-cli-5.2.6-2.el5s2
  php-mbstring-5.2.6-2.el5s2
  php-devel-5.2.6-2.el5s2
  php-pdo-5.2.6-2.el5s2
  php-gd-5.2.6-2.el5s2
  php-dba-5.2.6-2.el5s2
  php-common-5.2.6-2.el5s2
  php-bcmath-5.2.6-2.el5s2
  php-xml-5.2.6-2.el5s2
  php-pear-1.5.1-2.el5s2
  php-ldap-5.2.6-2.el5s2
  php-5.2.6-2.el5s2
  php-mysql-5.2.6-2.el5s2


 # php -v

  PHP 5.2.6 (cli) (built: Sep 15 2008 20:42:05)
  Copyright (c) 1997-2008 The PHP Group
  Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

Note: If your "php -v" output returns errors about PDO or JSON click here

Extras

Updating/Installing mcrypt

If you have php-mcrypt for PHP 5.1.x installed you'll want to remove it:

Note: Your version number maybe different. Alter below command accordingly.

 rpm -e php-mcrypt-5.1.6-15.el5.centos.1

Download php-mcrypt for PHP 5.2.x and install it. You can find a 32-bit php-mcrypt package here FedoraJunkies.

Note: You'll notice the "--nodeps" flag in the example. When you try to install php-mcrypt without it you get an error that php-common-5.2.6-2.el5s2 is missing even though it is installed.

 wget -c http://sourcemirrors.org/scotth/centos/5/php/php-mcrypt-5.2.6-2.i386.rpm
 rpm -i --nodeps php-mcrypt-5.2.6-2.i386.rpm

Restart Apache and you should now see mcrypt information on your testing.php page.

JSON and PDO being loaded twice

When you run the command "php -v" you might see the following errors:

 # php -v

  PHP Warning:  Module 'json' already loaded in Unknown on line 0
  PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
  PHP 5.2.6 (cli) (built: Sep 15 2008 20:42:05)
  Copyright (c) 1997-2008 The PHP Group
  Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

This is caused by the following two lines in the /etc/php.ini file:

; Extension JSON
extension=json.so

; Extension PDO
extension=pdo.so

Comment out these lines by adding a ";" in front of "extension=". These two modules are already loaded via these two files:

/etc/php.d/json.ini
/etc/php.d/pdo.ini

Installing phpMyAdmin on CentOS 5.6


Install MySQL packages
# yum install mysql-server mysql mysql-devel

Make MySQL boot up automatically
# chkconfig mysqld on

Start MySQL service
# service mysqld start

Set the password for the root user
# mysqladmin -u root password kezhong

Install php and common packages
# yum install php php-gd php-imap php-mysql php-pear php-xml phpxmlrpc curl libxml2 php-mbstring php-mcrypt

Install phpMyAdmin
Because the version of php on CentOS 5.6 is 5.1.6, we only can install phpMyAdmin 2.x, I choose 2.11.11.3.
# cd /usr/share
# wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/2.11.11.3/phpMyAdmin-2.11.11.3-english.tar.gz/download
# tar xvfz phpMyAdmin-2.11.11.3-english.tar.gz
# mv phpMyAdmin-2.11.11.3-english phpmyadmin
# rm phpMyAdmin-2.11.11.3-english.tar.gz
# cd phpmyadmin
# cp config.sample.inc.php config.inc.php

Edit the config.inc.php file, find the line that contain “blowfish_secret”, and modify like below.
$cfg['blowfish_secret'] = ‘TypeAnything_for_Secure’;

Append a line into the /etc/httpd/conf.d/phpmyadmin.conf file
# echo “Alias /phpMyAdmin /usr/share/phpmyadmin” >> /etc/httpd/conf.d/phpmyadmin.conf

Restart the httpd service
# service httpd restart

Enter the URL http://[IP Address]/phpMyAdmin/ on Firefox browser, we’ll can see the login web page.

Wednesday, August 3, 2011

Installing VNC server in UBUNTU 11.04

1. sudo apt-get install vnc4server

2. vncserver -geometry 1280x1024 -depth 24

3. vncserver -kill :1

4. vi .vnc/xstartup

Note :This will open up the file we need to edit.
Scroll down to the line which currently reads #unset SESSION_MANAGER and press the [Insert] key once (this will switch us into "edit" mode) and then remove the #

Do the same for the line after that. Plus change that line to read as follows:

exec sh /etc/X11/xinit/xinitrc

Note the "sh".

Change the xterm -geometry line as below

Once you've made these changes the file should look like this:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec sh /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

5. vncserver -geometry 1280x1024 -depth 24

6. vncpasswd 

Try to connect the sever from vnc viewer with x.x.x.x:1 and give the password


Sunday, July 17, 2011

How To Install FFmpeg, Mplayer, Mencoder, FFmpeg-PHP on CentOS 5.x


In this how to i will describe how to install ffmpeg, mplayer, mencoder, flvtool2, ffmpeg-php with all supported codecs to convert / manipulate videos easily on CentOS 5.x. If you want to run sites like youtube e.g www.indianpad.in, www.danceindiadance.in this howto will help you to install the base for your software. There are many other way to perform this but this works for me, so i want to share.
1 Setting Up RPMForge Respository.
RPMForge repository (http://dag.wieers.com) is the biggest rpm respository for RHEL, CentOS for all versions. To enable RPMForge respository run following command to install all necessary files for getting RPMForge repository. The following command directly install rpm from http://da.wieers.com site.
For i386/i686
For x86_64
This rpm will add necessary files in our repository configuration and can be viewed at /etc/yum.repos.d/rpmforge.repo
2 Install ffmpeg, mplayer, mencoder with all supported modules.
Now we have rpmforge repository, so we will use yum to install ffmpeg, mplayer, mencoder as well as all dependent software.
yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2
This command will some time to download and install all packages depends on your internet speed.
3 Install FFMPEG-PHP
ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. ffmpeg-devel and php-devel is needed to compile ffmpeg-php from source code. Use following steps to install ffmpeg-php
cd /usr/src
wget http://garr.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
tar jxvf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
phpize
./configure
make
make install
It will copy the ffmpeg.so module in php default module location. Now you have to edit php.ini file to enable ffmpeg-php support in it by using ffmpeg.so module.
vi /etc/php.ini
and append following line
extension=ffmpeg.so
Restart apache service to take effect of php.ini
/etc/init.d/httpd restart
Run following command to ffmpeg module listing in php.
php -m | grep ffmpeg

Note : If you get  error after “make” command

[root@server ffmpeg-php-0.6.0]# make
/bin/sh /usr/src/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c -o ffmpeg-php.lo
mkdir .libs
cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o
/bin/sh /usr/src/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c -o ffmpeg_movie.lo
cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c -fPIC -DPIC -o .libs/ffmpeg_movie.o
/usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_read_av_frame’:
/usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1215: warning: ‘avcodec_decode_video’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3454)
/bin/sh /usr/src/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c -o ffmpeg_frame.lo
cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c -fPIC -DPIC -o .libs/ffmpeg_frame.o
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_toGDImage’:
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_ffmpeg_frame’:
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1
==========================
Open the file under ffmpeg-php source directory
vi ffmpeg_frame.c
and replace all PIX_FMT_RGBA32 to /PIX_FMT_RGB32
or you can use search and replace like this
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32


How To Install FFmpeg, Mplayer, Mencoder, FFmpeg-PHP on CentOS 5.x


In this how to i will describe how to install ffmpeg, mplayer, mencoder, flvtool2, ffmpeg-php with all supported codecs to convert / manipulate videos easily on CentOS 5.x. If you want to run sites like youtube e.g www.indianpad.in, www.danceindiadance.in this howto will help you to install the base for your software. There are many other way to perform this but this works for me, so i want to share.
1 Setting Up RPMForge Respository.
RPMForge repository (http://dag.wieers.com) is the biggest rpm respository for RHEL, CentOS for all versions. To enable RPMForge respository run following command to install all necessary files for getting RPMForge repository. The following command directly install rpm from http://da.wieers.com site.
For i386/i686
For x86_64
This rpm will add necessary files in our repository configuration and can be viewed at /etc/yum.repos.d/rpmforge.repo
2 Install ffmpeg, mplayer, mencoder with all supported modules.
Now we have rpmforge repository, so we will use yum to install ffmpeg, mplayer, mencoder as well as all dependent software.
yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2
This command will some time to download and install all packages depends on your internet speed.
3 Install FFMPEG-PHP
ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. ffmpeg-devel and php-devel is needed to compile ffmpeg-php from source code. Use following steps to install ffmpeg-php
cd /usr/src
wget http://garr.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
tar jxvf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
phpize
./configure
make
make install
It will copy the ffmpeg.so module in php default module location. Now you have to edit php.ini file to enable ffmpeg-php support in it by using ffmpeg.so module.
vi /etc/php.ini
and append following line
extension=ffmpeg.so
Restart apache service to take effect of php.ini
/etc/init.d/httpd restart
Run following command to ffmpeg module listing in php.
php -m | grep ffmpeg

Note : If you get  error after “make” command

[root@server ffmpeg-php-0.6.0]# make
/bin/sh /usr/src/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c -o ffmpeg-php.lo
mkdir .libs
cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o
/bin/sh /usr/src/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c -o ffmpeg_movie.lo
cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c -fPIC -DPIC -o .libs/ffmpeg_movie.o
/usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function ‘_php_read_av_frame’:
/usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1215: warning: ‘avcodec_decode_video’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3454)
/bin/sh /usr/src/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c -o ffmpeg_frame.lo
cc -I. -I/usr/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/src/ffmpeg-php-0.6.0/include -I/usr/src/ffmpeg-php-0.6.0/main -I/usr/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c -fPIC -DPIC -o .libs/ffmpeg_frame.o
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_toGDImage’:
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_ffmpeg_frame’:
/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1
==========================
Open the file under ffmpeg-php source directory
vi ffmpeg_frame.c
and replace all PIX_FMT_RGBA32 to /PIX_FMT_RGB32
or you can use search and replace like this
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32


Saturday, April 30, 2011

TOMCAT Installing & Configuring in Cent OS 5.4


INSTALLING & CONFIGURING TOMCAT IN CENTOS 5.4

Download And Install JDK or J2SDK  on the server
You can download JDK or j2sdk from
http://java.sun.com/
I have downloaded jdk-6u18-linux-i586.bin .
Create a directory ‘java’ directory in /usr
   Mkdir /usr/java
Mv    jdk-6u18-linux-i586.bin /usr/java
Chmod  a+x jdk-6u18-linux-i586.bin
./ jdk-6u18-linux-i586.bin
Press enter for confirmation
It should end with “Done”
export JAVA_HOME=/usr/java/jdk1.6.0_22
export PATH=$JAVA_HOME/bin:$PATH
which java
]#/usr/java/jdk1.6.0_18/bin/java –version ‘or’ java –version

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
Create a file java.sh in /etc/profile.d directory and add the following
[#Java Environment script
export JAVA_HOME="/usr/java/jdk1.6.0_22"
export JAVA_PATH="$JAVA_HOME"
export PATH="$JAVA_HOME/bin:$PATH"

chmod a+x java.sh
When done, hit

 
source /etc/profile.d/java.sh 
 


Now any user root or other wise should be able to use the command;

which java
java -version


 
 
[root@localhost ~]#env


Install tomcat on the server:-
Create a group and user account for Tomcat to run

[root@server1 /]#groupadd tomcat
[root@server1 /]#useradd -g tomcat -s /usr/sbin/nologin -m -d /home/tomcat tomcat
Download apache tomcat
[root@server1 /]#tar -zxvf apache-tomcat-6.0.29.tar.gz
[root@server1 /]#mv apache-tomcat-6.0.29 /usr/local/

The directory where Tomcat is installed iscalled CATALINA_HOME.
Here in this case  CATALINA_HOME=/usr/local/apache-tomcat-6.0.24

Create symlink for the tomcat directory:-

[root@server1 /]#cd /usr/local
[root@server1 /]#ln -s apache-tomcat-6.0.29 apache-tomcat
[root@server1 /]#chown -h tomcat.tomcat /usr/local/apache-tomcat
[root@server1 /]#chown -R tomcat.tomcat apache-tomcat-6.0.29

 

 

Check the tomcat version installed.

Execute the following command:-
[root@server1 local]# /usr/local/apache-tomcat-6.0.29/bin/version.sh
Using CATALINA_BASE:   /usr/local/apache-tomcat-6.0.29
Using CATALINA_HOME:   /usr/local/apache-tomcat-6.0.29
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.29/temp
Using JRE_HOME:        /usr/java/jdk1.6.0_22
Using CLASSPATH:       /usr/local/apache-tomcat-6.0.29/bin/bootstrap.jar
Server version: Apache Tomcat/6.0.29
Server built:   July 19 2010 1458
Server number:  6.0.0.29
OS Name:        Linux
OS Version:     2.6.18-164.el5
Architecture:   i386
JVM Version:    1.6.0_22-b04
JVM Vendor:     Sun Microsystems Inc.



Start the tomcat
[root@server1 local]# /usr/local/apache-tomcat/bin/startup.sh
Check  the url  http://localhost:8080

Stop the tomcat
[root@server1 local]# /usr/local/apache-tomcat/bin/shutdown.sh

Setting Tomcat up as a Service (Optional):


If you want Tomcat to start automatically on boot then you need to set it up as a service. To do this you need to copy the code below and save it as a file called tomcat in the folder /etc/init.d:

CODE:
1. # This is the init script for starting up the
2. #  Jakarta Tomcat server
3. #
4. # chkconfig: 345 91 10
5. # description: Starts and stops the Tomcat daemon.
6. #
7.  
8. # Source function library.
9. . /etc/rc.d/init.d/functions
10.         
11.        # Get config.
12.        . /etc/sysconfig/network
13.         
14.        # Check that networking is up.
15.        [ "${NETWORKING}" = "no" ] && exit 0
16.         
17.        tomcat=/usr/local/tomcat
18.        startup=$tomcat/bin/startup.sh
19.        shutdown=$tomcat/bin/shutdown.sh
20.        export JAVA_HOME=/usr/java/jdk1.5.0_6
21.         
22.        start(){
23.         echo -n $"Starting Tomcat service: "
24.         #daemon -c
25.         $startup
26.         RETVAL=$?
27.         echo
28.        }
29.         
30.        stop(){
31.         action $"Stopping Tomcat service: " $shutdown
32.         RETVAL=$?
33.         echo
34.        }
35.         
36.        restart(){
37.          stop
38.          start
39.        }
40.         
41.         
42.        # See how we were called.
43.        case "$1" in
44.        start)
45.         start
46.         ;;
47.        stop)
48.         stop
49.         ;;
50.        status)
51.              # This doesn't work ;)
52.        status tomcat
53.        ;;
54.        restart)
55.        restart
56.        ;;
57.        *)
58.        echo $"Usage: $0 {start|stop|status|restart}"
59.        exit 1
60.        esac
61.         
62.        exit 0

You may have to change the value for JAVA_HOME if your JDK is in a different location to mine. You then need to make the file executable with the command:
sudo chmod +x /etc/init.d/tomcat
And finally you need to set it to start at boot with the command:
sudo chkconfig --add tomcat
You now have a working Tomcat install that will start itself at boot time. You can also interact with it using the service command to start, stop, restart and see the status of the service at any time. E.g.
sudo service tomcat start
sudo service tomcat satus
sudo service tomcat stop