buy tb500

Archive for August, 2010

Spam and exim commands

Thursday, August 26th, 2010

Spamming

Spamming can be either incoming or outgoing.

Incoming spamming might be concentrated to some domain or some email accounts.

Most of any incoming spamming is caused due to the catch-all being set as main account. If the catch-all for your domain is set to main account, set it as fail.

How to set catch-all for new domains in Cpanel server:

WHM >>Main >> Server Configuration >> Tweak Settings: Under Mail section

Default catch-all/default address behavior for new accounts. “fail” is usually the best choice if you are getting mail attacks.

Also, enable RBL and spamassasin options in WHM >> Main >> Exim Configuration

For outgoing spamming, some users may be using (knowingly or otherwise) some PHP scripts to try to send spam mails. You can find the source of PHP scripts using the command ‘ps -C exim -fH ewww |grep home’.

Preventive measures for spam blocking include:

  • Limit the emails that can be sent.
  • Tweak Mail settings as Follows:  WHM >>Main >> Server Configuration >> Tweak Settings: Under Mail section
  • The maximum each domain can send out per hour (0 is unlimited) : 300

Some helpful exim commands include:

exim -bp          (For showing queue)
exim -bpc          (Count of mail queue)
ps -C exim -fH ewww (For finding script sources )
exim -bp |exiqsumm (To get full exim queue summary )
exiqgrep -z -i | xargs exim -Mrm (Remove all frozen messages)

cron job in cpanel

Thursday, August 26th, 2010

How to setup Basic Cron Jobs.

Ok. Many people are yelling that they cannot configure the crons properly.
Here is a short tutorial which will help you set them. I have tried my best to explain the concept but there can be more advanced configurations.

Basically you will want to run a PHP script file in specific intervals. Suppose you want to execute a php file called maintanence.php every one hour. This is what you do :-

[ :P This tutorial is for noobs, Dont go into detail. Just do as instructed :P ]

The CRON Command is in the Following Format

[ Minute - Hour - Day - Month - Weekday ] - Command

The COMMAND, can be broken down in

[PATH OF PHP] [ARGUMENTS] [PATH OF PHP SCRIPT]

So the COMPLETE CRON command can be written as

[ Minute - Hour - Day - Month - Weekday ]  [PATH OF PHP] [ARGUMENTS] [PATH OF PHP SCRIPT]

The timing is spedified using * symbols

* * * * * => Execute every minute
0 * * * * => Execute every Hour
0 0 * * * => Execute every mid-night
0 0 0 * * => Execute every Month
0 0 0 0 * => Execute every Weekday

If you did not understand anything till now.. Good, this means you are a noob.. Read ahead :P

Since this is a UNIX command, You will have to Mention the PATH of PHP. At Astahost,

PATH TO PHP  : /usr/local/bin/php

( it also same at trap17, if users over there want to use it )

These are the Possible Command line Arguments you can use. This will effect the output. In our case, we will use the -q ( Quiet mode ) argument.

  -a               Run interactively
  -b <address:port>|<port> Bind Path for external FASTCGI Server mode
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse <file>.  Implies `-q'
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -q               Quiet-mode.  Suppress HTTP Header output.
  -s               Display colour syntax highlighted source.
  -v               Version number
  -w               Display source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.

The Path of the PHP file Must be Complete absolute path.
If you have an Account at TRAP, And your USERNAME is “tom”, Your path will be
“/home/tom/public_html/”

I assume you are familier with the PUBLIC_HTML directory. That is the Root folder where you store your html files.

So lets say that Tom wants to execute my script “maintenance.php” every hour. And it is stored in “public_html/cron/maintenance.php”;

So the Complete CRON command would be,

0 * * * * /usr/local/bin/php -q /home/tom/public_html/cron/maintenance.php

If tom wants to execute it every minute, he would use.

* * * * * /usr/local/bin/php -q /home/tom/public_html/cron/maintenance.php

If tom wants to execute it every Month, he would use.

0 0 0 * * /usr/local/bin/php -q /home/tom/public_html/cron/maintenance.php

There are more Complex forms of Assigning the TIMINGS for these scripts. You can go to CPANEL => Cron Jobs => Standard and set exact time when the script will be executed.

Also, this method used php, you can also use Curl .

refer to the URL below

http://www.knowledgesutra.com/forums/topic/6321-cron-jobs-cron-jobs-in-cpanel/

MySQL DB size shows 0 Mb in cPanel

Thursday, August 26th, 2010

When I logged to my cPanel >> Databases >> MySQL databases I see that the size all of my DB is show”n by 0 Mb
It”s wrong and I have found a fix for that.

1) Edit /var/cpanel/cpanel.config

Change:

disk_usage_include_sqldbs=0

to

disk_usage_include_sqldbs=1

Then run the following:

/scripts/update_db_cache

This may take a few minutes if you have a ton of users with databases, but after this, you should see the database disk usage show up accurately in cPanel.

Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Wednesday, August 25th, 2010

if you got  this error , that mean /tmp directory is full , in order to see full or not, just run this cummand   df

if you want to fix the problem just restart mysql database then /tmp automatic will be clear

service mysql restart

that is all

thank you.

Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at

Monday, August 23rd, 2010

to fix the problem you need to add this in index.php or login.php or any page that got the error,,  you need to put the code below

Up on top of your script, before includes etc. put this:

ob_start("ob_gzhandler"); reference http://forums.digitalpoint.com/showthread.php?t=475425

Install and configure FFmpeg and FFpeg-Php

Monday, August 23rd, 2010

There are two methods to install FFmpeg and FFmpeg-Php, their libraries, and modules:

  1. Using Yum on systems including Red Hat, CentOS, and Fedora Core.
  2. Manually, from source archives/packages

Method #1: Yum

*** Caution

  • You must remove all previous installation of FFmpeg and FFmpeg-Php, then follow installation instructions below.
  • Follow these steps (in that order):

First, make sure the following binary packages are installed on your server:

gcc, gcc4, gcc4-c++, gcc4-gfortran, gd, gd-devel, gmake, ImageMagick, ImageMagick-devel, libcpp, libgcc, libstdc++, make, ncurses, ncurses-devel, ruby, subversion

If any of these packages are missing, install them using Yum . For example:

  • yum install PACKAGE
  1. Install RPMForge Respository
    • rpm -Uhv ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
  2. Install ffmpeg, mplayer, mencoder with all supported libraries/modules
    • yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2
  3. Manually, install FFmpeg-Php
    • cd /usr/local/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

If FFmpeg-Php is compiled successfully, an ffmpeg.so module will be generated and copied into the default Php directory. Next, run the following command to enable FFmpeg-Php. By running this command you will be adding ffmpeg.so module into the php.ini file:

echo ‘extension=ffmpeg.so’ >> /local_path_to_your/php.ini

Final step, restart apache

service httpd restart
OR
/etc/init.d/httpd restart

– Testing FFmpeg
Verify that FFmpeg is working properly by running the following two commands:

  • php -r ‘phpinfo();’ | grep ffmpeg

You will get a few lines similar to the following:

ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => April  15 2010 15:31:45
ffmpeg-php gd support  => enabled
ffmpeg libavcodec version => Lavc51.62.0
ffmpeg libavformat version => Lavf52.18.0
ffmpeg swscaler => disabled
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

This is the second command to make sure that FFmpeg is working properly:

  • /usr/local/bin/ffmpeg

If you do not get any errors after running the test commands above, FFmpeg, FFmpeg-Php, MPlayer, MEncoder, and FLV2tool are working properly on your server. CONGRATULATIONS!

——————————-

Method #2: Source archives/packages

*** Caution

  • You must remove all previous installation of FFmpeg and FFmpeg-Php, then follow installation instructions below.
  • Follow these steps (in that order):

First, make sure the following binary packages are installed on your server:

gcc, gcc4, gcc4-c++, gcc4-gfortran, gd, gd-devel, gmake, ImageMagick, ImageMagick-devel, libcpp, libgcc, libstdc++, make, ncurses, ncurses-devel, ruby, subversion

If any of these packages are missing, install them using Yum . For example:

  • yum install PACKAGE

*** Caution

  • The following source packages are always updated with newer versions. You might experience technical issues if you download and install a newer/older version of any of these applications.
  • You must remove all previous installation of FFmpeg and FFmpeg-Php, then follow installation instructions below.

To install FFmpeg from source, execute the following commands (in that order).

  1. Let’s create a directory to do our work in:
    • mkdir /usr/local/src
    • cd /usr/local/src
  2. Download source packages
    • wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
    • wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
    • wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.2.tar.bz2
    • wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-ppc-20071007.tar.bz2
    • wget http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2
    • wget http://downloads.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz
    • wget http://biznetnetworks.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
    • wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
    • wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
    • wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz
    • wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
    • wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.2.tar.gz
    • wget http://downloads.sourceforge.net/project/re2c/re2c/0.13.5/re2c-0.13.5.tar.gz
    • wget http://download.m0k.org/handbrake/contrib/xvidcore-1.1.3.tar.gz
    • wget http://downloads.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20080324-2245.tar.bz2
  3. Extract source packages
    • tar xzf a52dec-0.7.4.tar.gz
    • tar jxvf amrnb-7.0.0.2.tar.bz2
    • tar jxvf amrwb-7.0.0.2.tar.bz2
    • tar jxvf essential-ppc-20071007.tar.bz2
    • tar jxvf faac-1.28.tar.bz2
    • tar xzf faad2-2.7.tar.gz
    • tar jxvf ffmpeg-php-0.6.0.tbz2
    • tar zxvf flvtool2-1.0.6.tgz
    • tar xzf lame-3.98.4.tar.gz
    • tar xzf libogg-1.1.4.tar.gz
    • tar jxvf libtheora-1.1.1.tar.bz2
    • tar xzf libvorbis-1.2.2.tar.gz
    • tar xzf re2c-0.13.5.tar.gz
    • tar xzf xvidcore-1.1.3.tar.gz
    • tar jxvf x264-snapshot-20080324-2245.tar.bz2
  4. Create the codecs directory & export files
    • mkdir /usr/local/lib/codecs
    • mv /usr/local/src/essential-ppc-20071007/* /usr/local/lib/codecs
    • chmod -R 755 /usr/local/lib/codecs
    • echo “/usr/local/lib” >> /etc/ld.so.conf
    • ldconfig
  5. Install SVN and Ruby (for RedHat/CentOS v5.x)
    • yum install subversion
    • yum install ruby
      OR (if you are using the cPanel control panel )

      • /scripts/installruby
      • /usr/local/cpanel/bin/ror_setup
    • yum install ncurses-devel
  6. Compile and install FLVtool2
    • cd /usr/local/src/flvtool2-1.0.6/
    • ruby setup.rb config
    • ruby setup.rb setup
    • ruby setup.rb install
  7. Compile and install LAME
    • cd /usr/local/src/lame-3.98.4
    • ./configure
    • make
    • make install
  8. Compile and install libOGG
    • cd /usr/local/src/libogg-1.1.4
    • ./configure
    • make
    • make install
    • PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    • export PKG_CONFIG_PATH
  9. Compile and install LibVorbis
    • cd /usr/local/src/libvorbis-1.2.2
    • ./configure
    • make
    • make install
  10. Compile and install Libtheora
    • cd /usr/local/src/libtheora-1.1.1
    • ./configure –with-ogg-libraries=/usr/local/lib/
    • make
    • make install
  11. Compile and install amrNB
    • cd /usr/local/src/amrnb-7.0.0.2
    • ./configure
    • make
    • make install
  12. Compile and install amrWB
    • cd /usr/local/src/amrwb-7.0.0.2
    • ./configure
    • make
    • make install
  13. Compile and install Liba52
    • cd /usr/local/src/a52dec-0.7.4
    • ./bootstrap
    • ARCh=’arch’
    • ./configure –enable-shared
    • make
    • make install
  14. Compile and install FAAC
    • cd /usr/local/src/faac-1.28
    • ./bootstrap
    • ./configure –with-mp4v2
    • make
    • make install
  15. Compile and install FAAD
    • cd /usr/local/src/faad2-2.7
    • ./configure –with-mpeg4ip
    • make
    • make install
  16. Compile and install XVIDCore
    • cd /usr/local/src/xvidcore/build/generic/
    • ./configure
    • make
    • make install
  17. Compile and Install X264 Snapshot
    • cd /usr/local/src/x264-snapshot-20080324-2245
    • ./configure –enable-shared
    • make
    • make install
  18. Compile and install RE2C
    • cd /usr/local/src/re2c-0.13.5
    • ./configure
    • make
    • make install
    • cp -aP /usr/local/bin/re2c /usr/bin/
  19. Download the latest release for FFmpeg and MPlayer from svn.mplayerhq.hu
    • cd /usr/local/src
    • svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg -r 15594
    • svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
    • svn update
  20. Compile and install MPlayer
    • cd /usr/local/src/mplayer
    • ./configure
    • make

    (STOP here.) Make sure MPlayer has been compiled successfully with NO errors. Do NOT proceed any further unless the MPlayer package has been compiled successfully.

    • make install
  21. Compile and install FFmpeg
    • cd /usr/local/src/ffmpeg/
    • mkdir /usr/local/src/ffmpeg/tmp
    • export TMPDIR=/usr/local/src/ffmpeg/tmp

    (The following ./configure command is one single line)

    • ./configure –enable-shared –enable-nonfree –enable-gpl –enable-pthreads –enable-liba52 –enable-libamr-nb –enable-libamr-wb –enable-libfaac –enable-libfaad –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libxvid –enable-cross-compile
    • make

    (STOP here.) Make sure FFmpeg has been compiled successfully with NO errors. Do NOT proceed any further unless the FFmpeg package has been compiled successfully.

    • make install
    • export LD_LIBRARY_PATH=/usr/local/lib/
  22. Finalize the codec setups:
    (Create symbolic links for the following modules. FYI: the number which comes after the extension *.so might differ from one server to another. The X‘s represent numbers. The number after *.so.5 must match the number after the *.so.5 at the end of the line.)

    • ln -s /usr/local/lib/libavformat.so.5X.XX.0 /usr/lib/libavformat.so.5X
    • ln -s /usr/local/lib/libavcodec.so.5X.XX.0 /usr/lib/libavcodec.so.5X
    • ln -s /usr/local/lib/libavutil.so.49.X.0 /usr/lib/libavutil.so.49
    • ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
    • /sbin/ldconfig
  23. Compile and install FFmpeg-Php
    • cd /usr/local/src/ffmpeg-php-0.6.0/
    • /usr/bin/phpize
    • ./configure
    • make

    (STOP here.) Make sure FFmpeg-Php has been compiled successfully with NO errors. Do NOT proceed any further unless the FFmpeg-Php package has been compiled successfully.

    • make install
      Verify that ffmpeg-php module is saved in the Php extensions directory by running:
    • ls -al /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so
  24. Add FFmpeg-Php module directive in php.ini file: (make sure the local path to your php.ini is correct.)
    • echo ‘extension=ffmpeg.so’ >> /usr/local/lib/php.ini
  25. Restart Apache to load FFmpeg-Php (for RedHat/CentOS v5.x)
    • service httpd restart

– Testing FFmpeg
Verify that FFmpeg is working properly by running the following two commands:

  • php -r ‘phpinfo();’ | grep ffmpeg

You will get a few lines similar to the following:

ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => April  15 2010 15:31:45
ffmpeg-php gd support  => enabled
ffmpeg libavcodec version => Lavc51.62.0
ffmpeg libavformat version => Lavf52.18.0
ffmpeg swscaler => disabled
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

This is the second command to make sure that FFmpeg is working properly:

  • /usr/local/bin/ffmpeg

If you do not get any errors after running the test commands above, FFmpeg, FFmpeg-Php, MPlayer, MEncoder, FLV2tool, LAME MP3 encoder & libOGG are working properly. CONGRATULATIONS!

References

http://servertune.com/kbase/entry/133/

XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.

Thursday, August 19th, 2010

to fix the problem , go to the xoops directory then find mainfile.php and edit it as below

change this vale define(‘XOOPS_CHECK_PATH’, ‘1’); to define(‘XOOPS_CHECK_PATH’, ‘o’);

then sure will be fixed,, i have tried this and fixed my issue prevously

Thank you.