19Jul Apache mod_proxy
Imagine your domain has ROR ( Ruby On Rails ) installed and it connects on port 1200
eg :- http://gnusys.net:1200 and you want to change the way it appears on the address bar as simply http://gnusys.net. Normally Apache won’t allow this as it is configured to work on port 80 as you all know. But there is a workaround for this issue ie by compiling Apache with mod_proxy . This module implements a proxy/gateway for Apache. I will now explain methods to compile this module in to Apache.
For a raw linux server ( with out any control panels ) you will get the mod_proxy module from the Apache source itself and if it is for any control panel specific server like Cpanel , Plesk etc just locate mod_proxy.c file and execute the follwoing command :-
/usr/local/apache/bin/apxs -cia /path/to/mod_proxy.c/file
and the compilation will be over in may be as fast as ten seconds. You can verify the compiled in module by running the command /usr/local/apache/bin/httpd -l
mod_proxy.c
proxy_connect.c
proxy_ftp.c
proxy_http.c
and you can also see the LoadModule option for mod_proxy inside httpd.conf .
18Jul Semaphore Arrays
Semaphore, it is a lot like a locking mechanism. In any server there is an order of precedence in which tasks must be accomplished. The semaphore is used to maintain that precedence order; more to the point, the precedence order is maintained by the semaphores. A succeeding task may not start until it has received the semaphores from all of it’s predecessors. Likewise child processes of services gets killed or removed before it passes information to its succeeding processes. So it leads them to a hung state because of this incomplete transaction. This will result to failure of these services until we remove the Sem-ids manually from their arrays. Given below is a small script to remove these arrays:-
ipcs -s | grep nobody | perl -e ‘while (<STDIN>) {
@a=split(/\s+/); print `ipcrm sem $a[1]`}’
There will be situations when Apache will fail because of the above reason , so you will need to just execute the above piece of code and restart Apache.
18Jul Plesk Control Panel icons missing!
Scenario:- Add Application icon missing or grayed out
“Add New Application” icon can be missing if “Hide all greyed out buttons by default” is enabled on the Server -> Interface management page in Plesk CP.
“Add New Application” can be greyed out if some application is already installed in the domains’ DocumentRoot folder (httpdocs or httpsdocs). It is impossible to add another application in this case because of possible applications conflict.
15Jul plesk DBWebadmin Access denied for user error
Sometimes you get the following error when accessing DBWebadmin (phpMyadmin ) in plesk
====
#1045 - Access denied for user ‘pma_tUuzljY3KmgS’@'localhost’ (using password: YES)
====
pma_tUuzljY3KmgS may vary according to your system
To fix this
vi /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php
and change the values of controluser , controlpass , pmadb to null
thats it ;save the file and now everything should work fine
Ref: http://forum.swsoft.com/showthread.php?s=&postid=167179#post167179
12Jul Howto manage qmail queue in Plesk linux
You can use third party programs like qmail-remove http://www.linuxmagic.com/opensource/qmail/qmail-remove to accomplish queue management in plesk control panel managed qmail
The Plesk control panel itself provides a modified version od qmHandle ( http://qmhandle.sourceforge.net/ )along with it that can be used with ease to manage the queue
To see the statistics of the queue:
–
/usr/local/psa/admin/bin/mailqueuemng -s
Messages in local queue: 0
Messages in remote queue: 0
Messages in todo queue: 0
Messages total: 0
Messages found: 0
Timestamp: 1215870834
–
From this you can see the status of qmails local,remote and todo list
If you wish to do a delivery of the queued messages now run the following command
/usr/local/psa/admin/bin/mailqueuemng -a
To list remote message queue:
/usr/local/psa/admin/bin/mailqueuemng -R
list local message queue:
/usr/local/psa/admin/bin/mailqueuemng -L
To list message queue:
list message queues -l
To delete messages with a particular pattern in the subject line
/usr/local/psa/admin/bin/mailqueuemng -S”text”
eg: /usr/local/psa/admin/bin/mailqueuemng -S”failure notice”
will delete all delivery failed messages
To delete all messages in the queue (Use with caution - possible data loss )
/usr/local/psa/admin/bin/mailqueuemng -D
12Jul howto install ffmpeg-php
According to the official ffmpeg-php website: 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. It has methods for returning frames from movie files as images that can be manipulated using PHP’s image functions
Inodder to use this extension;you must first install ffmpeg http://gnusys.net/install-ffmpeg-with-amr-nb-and-amr-wb-support/
and after that
1.Download ffmpeg-php from http://ffmpeg-php.sourceforge.net/
2.Untar the source package and run the following commands in the source directory
phpize
./configure && make
make install
You must also ensure that the extension is loaded correctly in the php configuration file
php –ini
will show the location of the php.ini file .You must ensure that the following line is present in your php.ini
extension=ffmpeg.so
Thats it.If you are using php as a DSO of apache ;then you may have to restart apache for the change to take effect
11Jul Install ffmpeg with amr-nb and amr-wb support
ffmpeg is a popular audio/video encoder and decoder . If you are planning to roll out a website that does video conversion like the popular youtube this document is for you . Now if you allow your users to upload content shot using mobile phones inoder to decode the same you may need AMR codec support which unfortunately is not shipped with ffmpeg binary packages available on the internet as this is a proprietary software and the license does not allow you to distribute any software that use this codec!. So what we do is compile these codec support into ffmpeg by grabbing the ffmpeg sources and compiling and installing the various external codecs
From the ffmpeg FAQ : FFmpeg can be hooked up with a number of external libraries to add support for more formats. None of them are used by default, their use has to be explicitly requested by passing the appropriate flags to `./configure’.
Here is the full configure options
—
neutron:~# ffmpeg -v
FFmpeg version SVN-r14147, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: –enable-shared –enable-gpl –enable-nonfree –enable-liba52 –enable-liba52bin –enable-libamr-nb –enable-libamr-wb –enable-libfaac –enable-libfaad –enable-libfaadbin –enable-libgsm –enable-libmp3lame –enable-libtheora
libavutil version: 49.7.0
libavcodec version: 51.60.0
libavformat version: 52.17.0
libavdevice version: 52.0.0
built on Jul 11 2008 06:00:59, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
—
Here is the step by step instruction to accomplish this configuration
Since the libraries are installed while compiling from source to /usr/local/lib ; we must include this in the linux loaders config file
neutron:~# vi /etc/ld.so.conf.d/usrlocal.conf
and add the following line in it
neutron:~# cat /etc/ld.so.conf.d/usrlocal.conf
/usr/local/lib
neutron:~#
1.Now you must download and install AMR codec libraries from
http://www.penguin.cz/~utx/amr
download amrnb ,amrwb and untar it
you must run
./configure && make && make install
inside the source directory inoder to install the amr(nb and wb) header files in /usr/local/include which is required by ffmpeg
!Please note that you do not have to install the codes from 3gp.org as this will be automatically downloaded in amr installation
2. Now you must download and nstall FAAC and FAAD2 from
http://www.audiocoding.com/downloads.html
And compile them in the same way
inside the source directory you must run
./bootstrap && ./configure && make && make install
3.Download and install liba52
http://liba52.sourceforge.net/downloads.html
install it in the same way using the following commands inside the source
./configure && make && make install
4.Now you have to install LAME
you can download the source from http://lame.sourceforge.net/index.php
instal lit using
./configure && make && make install
5.I needed the theora development libraries which was available in my apt repository.You can do a
apt-cache search theora or yum search theora according to the distribution you use
In debian sarge the folling command should be fine
apt-get install libtheora-dev
Done !.now its time to get ffmpeg sources. you can get the same from
http://lame.sourceforge.net/index.php . Please note that ffmpeg does not have a “official release”.So you must either checkout ffmpeg from svn or use the daily snapshot available at
http://ffmpeg.mplayerhq.hu/download.html
Untar the sources and cd to the source directory and run the following commands
./configure –enable-shared –enable-gpl –enable-nonfree –enable-liba52 –enable-liba52bin –enable-libamr-nb –enable-libamr-wb –enable-libfaac –enable-libfaad –enable-libfaadbin –enable-libgsm –enable-libmp3lame –enable-libtheora
make
make install
If everything goes well you must now have ffmpeg installed.If there is error check the file configure.err in the ffmpeg source directory for the cause of the error
Now as a final step you must check if all shared libraries are loaded fine
You must run the following commands to check this
neutron:~# which ffmpeg
/usr/local/bin/ffmpeg
neutron:~# ldd /usr/local/bin/ffmpeg
linux-gate.so.1 => (0×001b2000)
libavdevice.so.52 => /usr/local/lib/libavdevice.so.52 (0×005e2000)
libavformat.so.52 => /usr/local/lib/libavformat.so.52 (0×009a4000)
libavcodec.so.51 => /usr/local/lib/libavcodec.so.51 (0×00a43000)
libavutil.so.49 => /usr/local/lib/libavutil.so.49 (0×00110000)
libm.so.6 => /lib/tls/libm.so.6 (0×0011f000)
libc.so.6 => /lib/tls/libc.so.6 (0×007c7000)
libz.so.1 => /usr/lib/libz.so.1 (0×0026d000)
libdl.so.2 => /lib/tls/libdl.so.2 (0×00649000)
libamrnb.so.3 => /usr/local/lib/libamrnb.so.3 (0×00144000)
libamrwb.so.3 => /usr/local/lib/libamrwb.so.3 (0×00180000)
libfaac.so.0 => /usr/local/lib/libfaac.so.0 (0×001b3000)
libgsm.so.1 => /usr/lib/libgsm.so.1 (0×00582000)
libmp3lame.so.0 => /usr/local/lib/libmp3lame.so.0 (0×001c4000)
libtheora.so.0 => /usr/lib/libtheora.so.0 (0×00281000)
/lib/ld-linux.so.2 (0×00737000)
libogg.so.0 => /usr/lib/libogg.so.0 (0×007ad000)
neutron:~#
Sometimes you will receive ” cannot load shared library ” error while running ffmpeg or library “no found” in the ldd output.This is caused because you have not created/ updates the necessary links and cache (for use by the run-time linker, ld.so) to the most recent shared libraries
you can fix this error simply by running the following command
neutron:~# ldconfig
Please do not forget to include /usr/local/lib in your ld.so.conf which i have mentioned at the start of this article by editing the file /etc/ld.so.conf.d/usrlocal.conf. you can also add /usr/local/lib directly to ld.so.conf in older versions of GNU/Linux that does not use the /etc/ld.so.conf.d/ directory scheme
Hope you enjoyed this article..If you need me to install this for you just send me a mail at anoop[at]gnusys.net
WARNING:
libamr is copyrighted without any sort of license grant. This means that you can use it if you legally obtained it but you are not allowed to redistribute it in any way. Any FFmpeg binaries with libamr support you create are non-free and unredistributable!
REFERENCES:
http://ffmpeg.mplayerhq.hu/general.html#SEC1

