Thursday, April 25, 2013

Install FFMPEG Ordered steps

Install FFMPEG Ordered steps

Install FFMPEG Ordered steps
=======

1.Create a new Directory under the src folder

mkdir /usr/local/src/ffmpeg
cd /usr/local/src/ffmpeg

2.Download all the Sources

wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz

3.Uncompress all the source files

bunzip2 essential-20061022.tar.bz2; tar xvf essential-20061022.tar
tar zxvf flvtool2_1.0.5_rc6.tgz
tar zxvf lame-3.97.tar.gz
bunzip2 ffmpeg-php-0.5.0.tbz2; tar xvf ffmpeg-php-0.5.0.tar
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz

4.Create the new codecs directory and move the codecs

mkdir /usr/local/lib/codecs/
mv essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

5.Install SVN and Ruby

yum install subversion
yum install ruby
yum install ncurses-devel

6.Download the latest FFMPEG and Mplayer from the subversion

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

7.Compile LAME

cd /usr/local/src/ffmpeg/lame-3.97
./configure
make
make install

8.Compile libOGG

cd /usr/local/src/ffmpeg/libogg-1.1.3
./configure
make
make install

9.Compile libVorbis

cd /usr/local/src/ffmpeg/libvorbis-1.1.2
./configure
make
make install

10.Compile flvtool2

cd /usr/local/src/ffmpeg/flvtool2_1.0.5_rc6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install

11.Compile MPlayer

cd /usr/local/src/ffmpeg/mplayer
./configure
make
make install

12.Compile FFMPEG

cd /usr/local/src/ffmpeg/ffmpeg
./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --disable-mmx
--enable-shared
echo '#define HAVE_LRINTF 1' >> config.h
make
make install

13.Create symblinks

ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

14.Compile FFMPEG-PHP

cd /usr/local/src/ffmpeg/ffmpeg-php-0.5.0
phpize
./configure
make
make install

15.Install FFMPEG-PHP (make sure the php.ini path is correct.)

Get correct php.ini path add the extesion ffmpeg.so Usually it is given as extension=ffmpeg.so and the extension_dir=/usr/local/lib/php/extensions/

Make sure that the ffmpeg.so is in /usr/local/lib/php/extensions/

echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so'>>
/usr/local/Zend/etc/php.ini

Or the best way is to check the path for extension_dir in php.ini Then locate the file ffmpeg.so. Copy the file ffmpeg.so to extension_dir and add the line

extension=ffmpeg.so

in php.ini

16.Restart Apache to load FFMPEG-PHP

service httpd restart

17.Verify the installation

php -r 'phpinfo();' | grep ffmpeg

If you get a few lines such as

ffmpeg
ffmpeg support (ffmpeg-php) => enabled
ffmpeg-php version => 0.5.0
ffmpeg.allow_persistent => 0 => 0

Then everything is installed and working. FFMPEG, FFMPEG-PHP, MPlayer, MEncoder, flv2tool, LAME MP3 encoder & libOGG.

You can use mod_rewrite for redirecting http to https.

You can use mod_rewrite for redirecting http to https.
You need to go in the http vhost container and add the following:

========================================

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Or else, you can add the following lines

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

How to recover Plesk password ?

How to recover Plesk password ?

# /usr/local/psa/bin/admin --show-password

SETTING THE NEW PASSWORD USING COMMAND LINE:

# /usr/local/psa/bin/init_conf -u -passwd <new_password>

Adding Linux templates in SolusVM(OpenVZ)

Firstly, login to your server node vis SSH.
The download link for the distros : http://wiki.openvz.org/Download/template/precreated

Perform the following :
#cd /vz/template/cache
#wget http://wiki.openvz.org/Download/template/precreated/centos-5-x86-devel.tar.gz (CentOS 5 as an example)

Then, login to SolusVM and "Add new template". This will add the new distro.

Error while connecting PHPMyAdmin

Error while connecting PHPMyAdmin
Getting the following error when connecting to PhpMyAdmin :

"#2013 Cannot log in to the MySQL server"

Solution:

# vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php // Configuration file of PhpMyAdmin

Add localhost as follows

$cfg['Servers'][$i]['host'] = 'localhost';

save and quit the file.

Exim4 Error : "Fatal: no entropy gathering module detected"

Exim4 Error : "Fatal: no entropy gathering module detected"
I just want to share with you all the error that I came across regarding exim and here I'm providing the fix for it as well which worked perfectly for me. I tried to send email using 'mail' command which returned me this error message "Fatal: no entropy gathering module detected".

Here is the fix for this that got it working for me!

SSH to your server and perform the following steps :

# cd /dev
Here you can find either URANDOM and/or RANDOM
Delete them.

# rm -rf urandom
# rm -rf random

Now we have to remake both of them and chmod it.
# /sbin/MAKEDEV urandom
# /sbin/MAKEDEV random
# chmod 777 /dev/urandom
# chmod 777 /dev/random

Nagios Configuration

Nagios Configuration
Following steps will take place when Nagios (installed on Nagios server) monitors a service (eg: server load) on the remote host

1) Nagios will execute check_nrpe command on nagios-server and will request it to monitor disk usage on remote host using check_load command.
2) The check_nrpe on the nagios-server will contact the NRPE daemon on remote host and will request it to execute the check_load on remote host.
3) The results of the check_load command will be returned back by NRPE daemon to the check_nrpe on nagios-server.

Nagios Server (check_nrpe) ~~> Remote host (NRPE deamon) ~~> check_load

Nagios Server (check_nrpe) <~~ Remote host (NRPE deamon) <~~ check_load (returns the server load)

Before we begin, we need to install some packages on the remote host for Nagios to work fine.

# yum install elinks gcc make gcc-c++
# yum -y install openssl-devel
# useradd nagios
# passwd nagios
# cd /usr/src/

Then install Nagios plugin and NRPE on remote host.

Install Plug-in
# wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz/download
# tar -zxvf nagios-plugins-1.4.15.tar.gz && cd nagios-plugins-1.4.15
# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
# make
# make install
# chown nagios:nagios /usr/local/nagios
# chown -R nagios:nagios /usr/local/nagios/libexec
# cd ..

Install NRPE
#wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz/download
# tar -zxvf nrpe-2.12.tar.gz && cd nrpe-2.12
# ./configure
# make all
# make install-plugin
# make install-daemon
# make install-daemon-config
# make install-xinetd
Edit Xinetd NRPE entry
# vi /etc/xinetd.d/nrpe
only_from = 127.0.0.1 Server-IP (nagios monitoring server ip-address is: )
:wq (save and exit)

Edit services file entry
# vi /etc/services
nrpe 5666/tcp # Entry for NRPE daemon
:wq (save and exit)

Restart xinetd
# service xinetd restart

Verify whether NRPE is listening
# netstat -at |grep nrpe # output -: tcp 0 0 *:nrpe *.* LISTEN
Verify to make sure the NRPE is functioning properly
# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.12

Configuring Nagios monitoring server to monitor the remote host

# cd /usr/src
# wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.12/nrpe-2.12.tar.gz/download
# tar -zxvf nrpe-2.12.tar.gz && cd nrpe-2.12
# yum -y install openssl-devel
# yum install perl
# ./configure
# make all
# make install-plugin

Create a command definition
# vi /home/nagios/public_html/etc/objects/commands.cfg
Add the following:

# NRPE CHECK COMMAND
# Command to use NRPE to check remote host systems
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

Create configuration file for remote host
# cp –prf /home/nagios/www/etc/objects/ localhost.cfg /home/nagios/www/etc/objects/remotehost.cfg
# vi /home/nagios/www/etc/objects/remotehost.cfg
Replace the values “host_name” “alias” “address” with the values that match your setup:

** The “host_name” you set for the “define_host” section must match the “host_name” in the “define_service” section **

# Define a host for the remote machine
define host{
use linux-server ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name alpha235
alias alpha235
address 62.75.215.12
}
# SERVICE DEFINITIONS
# Define a service to "ping" the local machine

define service{
use generic-service ; Name of service template to use
host_name alpha235
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}

# Define a service to check the disk space of the root partition.

define service{
use generic-service ; Name of service template to use
host_name alpha235
service_description Root Partition
check_command check_nrpe!check_disk
}

# Define a service to check the number of currently logged in users on the remotehost.

define service{
use generic-service ; Name of service template to use
host_name alpha235
service_description Current Users
check_command check_nrpe!check_users
}

# Define a service to check the number of currently running processes on the remote host.

define service{
use generic-service ; Name of service template to use
host_name alpha235
service_description Total Processes
check_command check_nrpe!check_total_procs
}
# Define a service to check the load on the remote host.

define service{
use generic-service ; Name of service template to use
host_name alpha235
service_description Current Load
check_command check_nrpe!check_load
}

# Define a service to check SSH on the remote host.
# Disable notifications for this service by default, as not all users may have SSH enabled.

define service{
use generic-service ; Name of service template to use
host_name alpha235
service_description SSH
check_command check_nrpe!check_ssh
notifications_enabled 0
}
# Define a service to check HTTP on the remote host.
# Disable notifications for this service by default, as not all users may have HTTP enabled.
define service{
use generic-service ; Name of service template to use
host_name alpha235
service_description HTTP
check_command check_nrpe!check_http
notifications_enabled 0
}

Activate the remotehost.cfg template
# vi /usr/local/nagios/etc/nagios.cfg
Definitions for monitoring remote Linux machine
cfg_file=/home/nagios/www/etc/objects/remotehost.cfg
Verify Nagios Configuration Files
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# /home/nagios/public_html/bin/nagios -v /home/nagios/public_html/etc/nagios.cfg (In our server)
Output : ...
...
Things look okay - No serious problems were detected during the pre-flight check

Verify whether nagios monitoring server can talk to the remote host
# /usr/local/nagios/libexec/check_nrpe -H 62.75.215.12
NRPE v2.12

Start nagios
# /home/nagios/www/bin/nagios -d /home/nagios/www/etc/nagios.cfg

Restart nagios (if already running)
# kill -HUP <nagios_pid>

# /usr/local/nagios/libexec/check_nrpe -H 62.75.215.12 -c check_load (To check the load of the remote server)
OK - load average: 0.35, 0.30, 0.23|load1=0.350;15.000;30.000;0; load5=0.300;10.000;25.000;0; load15=0.230;5.000;20.000;0;

(Usage: check_nrpe -H <host> [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>])

Sunday, April 21, 2013

Turn OFF/ON "Spam Box" in WHM

Turn OFF "Spam Box" in WHM -> Tweak Settings -> Mail.
This just allows the user to control it, but I wanted it always on and I want to forward to the ".Junk" folder anyways.
WHM -> Tweak Settings -> Mail -> Enable SpamAssassin Spam Box: OFF
WHM -> Tweak Settings -> Mail -> Enable SpamAssassin spam filter: ON
WHM -> Exim Configuration Editor -> SpamAssassin Options -> SpamAssassin: Forced Global ON: ON

http://forums.cpanel.net/f43/can-you-change-spamassassin-spam-box-folder-223951.html

Security Update: Atomic Mod Security setup guide for cPanel

As to help our VPS and Dedicated Server customers who might also be effected by this we have designed the following guide to make installing Atmoic Mod Security into cPanel with little to no fuss.

Stage 1: Run the following commands at command line:

mkdir /var/asl
mkdir /var/asl/tmp
mkdir /var/asl/data
mkdir /var/asl/data/msa
mkdir /var/asl/data/audit
mkdir /var/asl/data/suspicious
chown nobody.nobody /var/asl/data/msa
chown nobody.nobody /var/asl/data/audit
chown nobody.nobody /var/asl/data/suspicious
chmod o-rx -R /var/asl/data/*
chmod ug+rwx -R /var/asl/data/*
mkdir /var/asl/updates
mkdir /var/asl/rules/
mkdir /var/asl/rules/clamav
mkdir /etc/asl/
touch /etc/asl/whitelist
cd /usr/local/src/
wget http://updates.atomicorp.com/channels/rules/delayed/modsec-2.7-free-latest.tar.gz
tar zxvf modsec-2.7-free-latest.tar.gz
mkdir /usr/local/apache/conf/modsec_rules/
cp modsec/* /usr/local/apache/conf/modsec_rules/
These command will create the required directory’s and download the latest free version of the Atomic Mod Security rules. It will also directly install them into the location of Apache designed for cPanel and configure the permission.

Stage 2: Configure cPanel to use the Mod Security Rules

In this stage, you can do everything from WHM as long as you have Mod Security already installed as part of your EasyApache build. If you do not, you will need to rebuild apache with Mod Security.

In go to: WHM -> Plugins -> Mod Security and then click: Edit Config

In this section, delete all the current content and then paste in the following configuration:

SecRequestBodyAccess On
SecAuditLogType Concurrent
SecResponseBodyAccess On
SecResponseBodyMimeType (null) text/html text/plain text/xml
SecResponseBodyLimit 2621440
SecAuditLogRelevantStatus "^(?:5|4(?!04))"
SecServerSignature Apache
SecUploadDir /var/asl/data/suspicious
SecUploadKeepFiles Off
SecAuditLogParts ABIFHZ
SecArgumentSeparator "&"
SecCookieFormat 0
SecRequestBodyInMemoryLimit 131072
SecDataDir /var/asl/data/msa
SecTmpDir /tmp
SecAuditLogStorageDir /var/asl/data/audit
SecResponseBodyLimitAction ProcessPartial

Include /usr/local/apache/conf/modsec_rules/10_asl_antimalware.conf
Include /usr/local/apache/conf/modsec_rules/10_asl_rules.conf
Include /usr/local/apache/conf/modsec_rules/20_asl_useragents.conf
Include /usr/local/apache/conf/modsec_rules/30_asl_antispam.conf
Include /usr/local/apache/conf/modsec_rules/50_asl_rootkits.conf
Include /usr/local/apache/conf/modsec_rules/60_asl_recons.conf
Include /usr/local/apache/conf/modsec_rules/99_asl_jitp.conf
Include /usr/local/apache/conf/modsec2.whitelist.conf
Save this and restart Apache.

This should now have successfully installed the Atomic mod security rules into cPanel which are a much more secure rule base and include extra protection which is important for the latest hacks.

Saturday, April 20, 2013

Fixing su: cannot set user id: Resources temporarily

#su -
su: cannot set user id: Resource temporarily unavailable
#

After searching and googling few minutes, i found a quick resolution to fixing this issue.
This is all about VPS limit.

Edit limit.conf below or change if needed.
#vi /etc/security/limit.conf
#### add/change on these line below:
* soft nproc 2047
* hard nproc 16384
* soft nofile 2048
* hard nofile 65536

After that try to relogin using a normal access user and then try to get su -
this should fixed your issue.

Friday, April 19, 2013

Conver Putty ppk key to SSH key

In many occasions I needed to convert a Putty ppk private key nack to open ssh key to be able to use it directly from a linux box command line. It is fairly simple to do but I always need to look it up so here it is for easy reference :

Install putty using yum in Fedora.
If you are using Ubuntu you need to install putty-tools as well

From the command line give

puttygen xxxxx2.ppk -O private-openssh -o key.ssh

Enter passphrase to load key:

Then log onto your system using

ssh root@84.200.82.6 -p 8057 -i key.ssh

Tuesday, April 16, 2013

Troubleshooting apache

check httpd service is running or not

• if its not starting the check the syntax of the config file
#httpd -S (display the all files and its location )
#httpd -t or apachectl configtest
if syntax is ok the config file is correct
• check the error logs of apache
/var/log/httpd/error_log
• apache also requires working dsn client support via /etc/resolv.conf and make sure dns is working fine
• check httpd.conf file there is correct entry of server name is there or not and check the port no
• check the size of the log file if it is full then it ll cause error 500 so make sure that log files are under limit and we can us e tool called logrotate in /etc/logrorate.d/httpd create configuration file for httpd log files
• It is possible that some other process may be using port 80 or 443. Use netstat command to list open port and their owners:
#nestat -tulpn
#netstat -tulpn |grep ‘:80′
If other process using port 80 / 443, you need to stop them or assign another port to Apache

What is SPF records and How to setup?

Why Is My Emails Getting As Spam?
Check above things.

First we need to check Email Headers.
1. Return Path
2. To
3. From
4. We should not use CAPS because not only being unprofessional, but it
also triggers spam filters. To land in the Spam folder consistently,
please do not USE ALL CAPS IN THE SUBJECT LINE AND THE BODY FROM TO and
Excessive punctuation (e.g. -/, ;^%#$@+ * "').

E.g. as follows.

1. Email "From : ADMIN ENROLL <noreply@exmaple.com>" getting
spam in gmail.com sometimes and if we not change it will increasing
count.

2. Email "From: noreply@exmaple.com" it
getting in mailbox, check the CAPS deference.

http://php.net/manual/en/function.mail.php
http://www.niso.org/khelp/kmlm/user_help/html/examine_mail_headers.html

Please check this too. It can be understand better. :)
http://www.infusionblog.com/email-marketing/7-ways-for-your-email-to-land-in-the-spam-folder/

Check SPF for Domain.:
http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/

What is SPF records and How to setup?
http://www.kazeli.com/help/index.cfm?pageloc=quest&questid=435&catid=337,338

To diagnose the mail. Why its going in Spam.
Check tool:
http://mxtoolbox.com/
Here you can check following points
1. Mxlookup : For your domain and ip
2. Blacklist : For your IP
3. Diagnostics : SMTP Diagnostics, check your mail server
4. Analyze Headers : Check your mail headers.
5. SPF Records : Check your Sender Policy Framework
7. DNS Lookup : Check your Domain lookup.

If you check above all things your mail will not go in Spam.!

Fast up Httpd

The Apache’s configuration file is located at “/usr/local/apache/conf/httpd.conf” in a cPanel server

Timeout
This directive “Timeout” is used to define the amount of time Apache will wait for a GET, POST, PUT request and ACKs on transmissions before automatically disconnect when idle time exceeds this value. The ideal value will be 120 in heavily loaded servers. It is recommended to set this value lower if your clients have low latencies. Some time, setting this directive to a low value may pause problem, this highly depend on your network and server setup. The best is to experiment with different values to find the one that fit your need.

KeepAlive
This directive “KeepAlive” if set to “On”, enables persistent connections on the web server. For better performance, it’s recommended to set this option to “On” and allow more than one request per connection.

MaxKeepAliveRequests
This directive is used to define the number of requests allowed per connection when the KeepAlive option above is set to “On”. When the value of this option is set to “0″ then unlimited requests are allowed on the server. For server performance, it’s recommended to allow unlimited requests.

KeepAliveTimeout
This directive is used to define how much time, in seconds, Apache will wait for a subsequent request before closing the connection. Once a request has been received, the timeout value specified by the “Timeout” directive applies. The value of “10″ seconds is a good average for server performance. This value should be kept low as the socket will be idle for extended periods otherwise.

MaxClients
This directive is used to define the limit on the number of child processes that will be created to serve requests. The default means that up to 512 HTTP requests can be handled concurrently. This is an important tuning parameter regarding the performance of the Apache web server. For high load operation, a value of “512″ is recommended. For standard use, you can set the value to “256″.

MinSpareServers
This directive is used to define the minimum number of idle child server processes that should be created. An idle process is one which is not handling a request. If there are fewer than “MinSpareServers” idle, then the parent process creates new children at a maximum rate of 1 per second. The idle value is 10
MaxSpareServer
This directive is used to define the maximum number of idle child server processes that should be created. If there are more than “MaxSpareServers” idle child processes, then the parent process will kill off the excess processes and these extra processes will be terminated.The idle value is 15.

MaxRequestsPerChild
This option “MaxRequestsPerChild” is used to define the number of requests that an individual child server process will handle. Set this directive to “0″ to get the maximum performance and scalability for the server.

HostnameLookups
This directive if set to “Off”, specifies to disable DNS lookups. It’s recommended to set this option to “Off” in order to avoid latency to every request, to save the network traffic time, and to improve the performance of your Apache web server.

cpanel exim limit spam

Hello,

The following cPanel/Exim configuration will help you stopping spam in the server.

1. Login to WHM control panel
2. Goto Main >> Service Configuration >> Exim Configuration Manager
3. Enable RBL filtering by Basic Editor >> RBLs >> switch to “On” and if you like you may additional RBL from manage option.
4. Enable Sender Verification by Mail >> Sender Verification >> “On” this will check if the mail origin really exists.
5. Reject SPF failures by ACL Options >> Reject SPF failures >> “On” this will verify SPF records and if the SPF record is set to fails then the E-mails from those IPs will be rejected.
6. Home >> Server Configuration >> Tweak Settings
7. Turn “Initial default/catch-all forwarder destination” to “fail” this will fail the catch all feature to be sent to default cPanel account.
8. “Set Max hourly emails per domain” which will limit the E-mail flooding from the server(I normally set it to 70 which is good enough for a single domain for an hour).
9. Set “Maximum percentage of failed or deferred messages a domain may send per hour” everyone knows that Spam E-mails will have alot of non existing E-mail which will then be deferred so If we set this to say 50% the spamming E-mail account will be suspended temporarily if the deferred mails are above 50%.

10. Then save all the configuration this will stop most of spams in the server.

HOW-TO: Install APC Direct admin

Install autoconf:
Code:
apt-get install autoconf
Install APC using PECL:

Code:

pecl install apc
After install process we have messages like this:

Code:

Build process completed successfully
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/apc.so'
install ok: channel://pecl.php.net/APC-3.0.19
configuration option "php_ini" is not set to php.ini location
You should add "extension=apc.so" to php.ini
Edit php.ini (via DA or directly: /usr/local/lib/php.ini)
modify extension_dir directive:
Code:

; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"
Enable extension apc.so:

Code:

extension=apc.so

CustomBuild 2.0 FAQ (DirectAdmin 1.43 or later is needed)

1. What is custombuild?
Custombuild is a tool, which can install/update:
Apache
AWstats
Autoconf
Automake
ClamAV
cURL
Dovecot
Exim configuration files
FreeType
GD
ionCube loaders
libiconv
libjpeg
libpng
libmcrypt
libmhash
mod_perl
mod_ruid2
nginx
MySQL
PHP (mod_php, php-fastcgi, PHP-FPM, suPHP)
ProFTPD
Pure-FTPd
SpamAssassin
Webalizer
Zend Optimizer
Zlib

Update web-applications:
Roundcube webmail
Squirrelmail webmail
phpMyAdmin

How to upgrade custombuild to 2.0?
The best way to do that is a complete reinstallation of CustomBuild, because of changes in configuration files, options.conf etc. Please note that you need DirectAdmin version 1.43 RC1 at least (you can use current pre-release binaries too) to run CustomBuild 2.0.

Code:

+++++++++++

cd /usr/local/directadmin
mv custombuild custombuild_1.x
wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz
tar xvzf custombuild.tar.gz
cd custombuild
../build
Please check your options.conf file, set the settings you would like to have. The following steps are needed after upgrade of the CustomBuild script, if you would like to use apache:

+++++++++++++++

Code:

../build apache
../build php n
../build rewrite_confs

However, if you want to rebuild everything:

+++++++++++++++++

Code:
../build all d

3. How to install custombuild 2.0?

Code:

cd /usr/local/directadmin
wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz
tar xvzf custombuild.tar.gz
cd custombuild
../build

You need to run this command for the first time:
Code:
../build all d

=========

http://forum.directadmin.com/showthread.php?t=44743

=========

Sunday, April 7, 2013

MYSQL

mysql> create database kerala_wp1;
Query OK, 1 row affected (0.00 sec)

mysql> create user wp1;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON kerala_wp1.* TO 'wp1'@localhost IDENTIFIED BY 'keralainasia';
Query OK, 0 rows affected (0.00 sec)

mysql> REVOKE ALL PRIVILEGES ON kerala_wp1.* FROM 'wp1'@localhost;
Query OK, 0 rows affected (0.00 sec)

 

# [mysql dir]/bin/mysql -h hostname -u root -p

mysql> create database [databasename];
mysql> show databases;

mysql> use [db name];
mysql> show tables;

mysql> describe [table name];

mysql> drop database [database name];
mysql> drop table [table name];

mysql> SELECT * FROM [table name];
mysql> show columns from [table name];
grant usage on *.* to bob@localhost identified by ‘passwd’;
grant all privileges on databasename.* to username@localhost;
flush privileges;

SET PASSWORD FOR ‘user’@'hostname’ = PASSWORD(‘passwordhere’);

+ Check, Repair and Optimize All tables in All Databases when you’re running a MySQL server on Linux.
# mysqlcheck –auto-repair –check –optimize –all-databases

OR
# mysqlcheck –all-databases -r #repair databases
# mysqlcheck –all-databases -a #analyze databases
# mysqlcheck –all-databases -o #optimize databases

=> Check, Repair and Optimize Single Database Tables.
# mysqlcheck –auto-repair –check –optimize CpanelUsername_Databasename
# mysqlcheck -ro CpanelUsername_Databasename

=> To repair One Table in database:
# mysqlcheck -ro CpanelUsername_Databasename table_name
Shows you if any need repair:
# myisamchk –check /var/lib/mysql/*/*.MYI

Then try ‘safe-recover’ first:
# myisamchk –safe-recover /var/lib/mysql/*/*.MYI

and, if neither “safe-recover” or “recover” option works:
# myisamchk –recover /var/lib/mysql/*/*.MYI

Then use the ‘force’ flag:
# myisamchk –recover –extend-check –force /var/lib/mysql/*/*.MYI
mysql> REVOKE INSERT,UPDATE,DELETE ON DATABASENAME.* FROM user1@localhost;

REVOKE ALL PRIVILEGES, GRANT OPTION FROM user [, user]…

REVOKE ALL PRIVILEGES OPTION FROM 'wp1'@'localhost';

REVOKE ALL PRIVILEGES ON kerala_wp1.* FROM 'wp1'@localhost;
Dump a table from a database.
[mysql dir] mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

Restore database (or database table) from backup.
[mysql dir] mysql -u username -ppassword databasename < /tmp/databasename.sql
mysql> create database kerala_wp1;
Query OK, 1 row affected (0.00 sec)

mysql> create user wp1;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON kerala_wp1.* TO 'wp1'@localhost IDENTIFIED BY 'keralainasia';
Query OK, 0 rows affected (0.00 sec)

mysql> REVOKE ALL PRIVILEGES ON kerala_wp1.* FROM 'wp1'@localhost;
Query OK, 0 rows affected (0.00 sec)

How To Use rsync For Transferring Files

Task : Copy file from a remote server to a local computer


Copy file /home/jerry/webroot.txt from a remote server openbsd.nixcraft.in to a local computer's /tmp directory:
$ rsync -v -e ssh jerry@openbsd.nixcraft.in:~/webroot.txt /tmp

Task: Synchronize a local directory with a remote directory


$ rsync -r -a -v -e "ssh -l jerry" --delete /local/webroot openbsd.nixcraft.in:/webroot

Task: Synchronize a remote directory with a local directory


$ rsync -r -a -v -e "ssh -l jerry" --delete openbsd.nixcraft.in:/webroot/ /local/webroot

Task: Synchronize a local directory with a remote rsync server or vise-versa


$ rsync -r -a -v --delete rsync://rsync.nixcraft.in/cvs /home/cvs
OR
$ rsync -r -a -v --delete /home/cvs rsync://rsync.nixcraft.in/cvs

Resetting Wordpress Password

Get an MD5 hash of your password.)Visit md5 Hash Generator, or...http://www.miraclesalad.com/
Create a key with Python. or...
On Unix/Linux:Create file wp.txt with the new password in it (and *nothing* else)
md5sum wp.txt
rm wp.txt
"mysql -u root -p" (log in to MySQL
enter your mysql password
"use (name-of-database)" (select WordPress database)
"show tables;" (you're looking for a table name with "users" at the end)
"SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" (this gives you an idea of what's going on inside)
"UPDATE (name-of-table-you-found) SET user_pass="(MD5-string-you-made)" WHERE ID = (id#-of-account-you-are-reseting-password-for)" (actually changes the password)
"SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" (confirm that it was changed)
(type Control-D, to exit mysql client)
Note if you have a recent version of MySQL (version 5.x?) you can have MySQL compute the MD5 hash for you.
Skip step 1. above.
Do the following for step 7. instead.
"UPDATE (name-of-table-you-found) SET user_pass = MD5('"(new-password)"') WHERE ID = (id#-of-account-you-are-reseting-password-for)" (actually changes the password)
Note that even if the passwords are salted, meaning they look like $P$BLDJMdyBwegaCLE0GeDiGtC/mqXLzB0, you can still replace the password with an MD5 hash, and Wordpress will let you log in.

========================

Get an MD5 hash of your password. (log in to MySQL)Visit md5 Hash Generator, or...
Create a key with Python. or...
On Unix/Linux:Create file wp.txt with the new password in it (and *nothing* else)
md5sum wp.txt
rm wp.txt
>>mysql

>>>>use <name-of-database>;


>>>>show tables;---(you're looking for a table name with "users" at the end)

>>>>SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" ;
>>>>"UPDATE (name-of-table-you-found) SET user_pass="(MD5-string-you-made)" WHERE ID = (id#-of-account-you-are-reseting-password-for)" (actually changes the password)

>>>>"SELECT ID, user_login, user_pass FROM (name-of-table-you-found)" (confirm that it was changed)
========================

Resize /tmp in cpanel servers

service chkservd stop
service httpd stop
service mysql stop
service postgresql stop

lsof | grep /tmp

kill the process

umount /var/tmp

umount /tmp

vi /scripts/securetmp

replace “256000″ with “512000″

rm -rf /usr/tmpDSK
/scripts/securetmp –auto

cd /tmp

ln -s /var/lib/mysql/mysql.sock

service postgresql start
service mysql start
service httpd start
service chkservd start

Saturday, April 6, 2013

Change the hostname

You have to change the hostname in the following files:

/etc/hosts
/etc/sysconfig/network
/proc/sys/kernel/hostname

Find spamming account in Postfix or Plesk

Queue Counting
The following command provides a sorted list of the accounts that have the most mail in the queue. This usually means a maximum of 2 or 3 spammers at the end of the list:

mailq|grep ^[A-F0-9]|cut -c 42-80|sort |uniq -c|sort -n|tail

grep “status=sent” /var/log/maillog |cut -d “=” -f 2 |cut -d “>” -f 1 |cut -d “<” -f 2 |sort -n |uniq -c

grep “dovecot” /var/log/maillog |grep “Aborted login” |cut -d “,” -f 3 |cut -d “:” -f 4 |sort -n |uniq -c

Making the CSF temporary block permanent

Temporary to Permanent IP blocking. The following enables this feature to
# permanently block IP addresses that have been temporarily blocked more than
# LF_PERMBLOCK_COUNT times in the last LF_PERMBLOCK_INTERVAL seconds. Set
# LF_PERMBLOCK to "1" to enable this feature
#
# Care needs to be taken when setting LF_PERMBLOCK_INTERVAL as it needs to be
# at least LF_PERMBLOCK_COUNT multiplied by the longest temporary time setting
# (TTL) for blocked IPs, to be effective
#
# Set LF_PERMBLOCK to "0" to disable this feature
LF_PERMBLOCK =  Default: 1 [0-1]

LF_PERMBLOCK_INTERVAL =  Default: 86400 [3600-604800]

LF_PERMBLOCK_COUNT =  Default: 4 [1-20]

LF_PERMBLOCK_ALERT =  Default: 1 [0-1]

# Permanently block IPs by network class. The following enables this feature
# to permanently block classes of IP address where individual IP addresses
# within the same class LF_NETBLOCK_CLASS have already been blocked more than
# LF_NETBLOCK_COUNT times in the last LF_NETBLOCK_INTERVAL seconds. Set
# LF_NETBLOCK to "1" to enable this feature
#
# This can be an affective way of blocking DDOS attacks launched from within
# the same networ class
#
# Valid settings for LF_NETBLOCK_CLASS are "A", "B" and "C", care and
# consideration is required when blocking network classes A or B
#
# Set LF_NETBLOCK to "0" to disable this feature
LF_NETBLOCK =  Default: 0 [0-1]

LF_NETBLOCK_INTERVAL =  Default: 86400 [3600-604800]

LF_NETBLOCK_COUNT =  Default: 4 [1-20]

LF_NETBLOCK_CLASS =  Default: C [A or B or C]

LF_NETBLOCK_ALERT =  Default: 1 [0-1]

################################################################

SCP in detail

Example syntax for Secure Copy (scp)
What is Secure Copy?
scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.
Examples
Copy the file "foobar.txt" from a remote host to the local host







$ scp your_username@remotehost.edu:foobar.txt /some/local/directory

Copy the file "foobar.txt" from the local host to a remote host







$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory

Copy the directory "foo" from the local host to a remote host's directory "bar"







$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar

Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu"







$ scp your_username@rh1.edu:/some/remote/directory/foobar.txt \

your_username@rh2.edu:/some/remote/directory/

Copying the files "foo.txt" and "bar.txt" from the local host to your home directory on the remote host







$ scp foo.txt bar.txt your_username@remotehost.edu:~

Copy the file "foobar.txt" from the local host to a remote host using port 2264







$ scp -P 2264 foobar.txt your_username@remotehost.edu:/some/remote/directory

Copy multiple files from the remote host to your current directory on the local host







$ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} .







$ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .

scp Performance
By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.







$ scp -c blowfish some_file your_username@remotehost.edu:~

It is often suggested that the -C option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU. An example of using blowfish and compression:







$ scp -c blowfish -C local_file your_username@remotehost.edu:~

How do I turn on/off mod_userdir on my cPanel/WHM server?

Apache's mod_userdir allows users to view their sites by entering a tilde(~) and their username as the uri on a specific host. For example http://test.cpanel.net/~fred/ will bring up the user fred's domain. The disadvantage of this feature is that any bandwidth usage used by this site will be put on the domain it is accessed under (in this case test.cpanel.net). mod_userdir protection prevents this from happening. You may however want to disable it on specific virtual hosts (generally shared ssl hosts.)

First you'll need to login to WHM for your server, http://serversip/whm (serversip being the ip address of your dedicated server or vps).

Once you are logged into WHM, you will want to browse over to the following path:

Main >> Security Center >> Apache mod_userdir Tweak

From there, you can select which accounts you want to enable for mod_userdir

Hard drive replacement in Software-RAID/en

The Following Following configuration is Assumed:
# Cat / proc / mdstat
Personalities: [raid1]
md3: active raid1 sda4 [0] sdb4 [1]
1822442815 blocks super 1.2 [2/2] [UU]

md2: active raid1 sda3 [0] sdb3 [1]
1073740664 blocks super 1.2 [2/2] [UU]

md1: active raid1 sda2 [0] sdb2 [1]
524276 blocks super 1.2 [2/2] [UU]

md0: active raid1 sda1 [0] sdb1 [1]
33553336 blocks super 1.2 [2/2] [UU]

unused devices: <none>

There are four partitions in total:

  • / Dev/md0 as swap

  • / Dev/md1 as / boot

  • / Dev/md2 as /

  • / Dev/md3 as / home


/ Dev / sdb is the defective drive in this case. A missing or defective drive is shown by [U_] and / or [_U] . If the RAID array is intact, it shows [UU] .
# Cat / proc / mdstat
Personalities: [raid1]
md3: active raid1 sda4 [0] sdb4 [1] (F)
1822442815 blocks super 1.2 [2/1] [U_]

md2: active raid1 sda3 [0] sdb3 [1] (F)
1073740664 blocks super 1.2 [2/1] [U_]

md1: active raid1 sda2 [0] sdb2 [1] (F)
524276 blocks super 1.2 [2/1] [U_]

md0: active raid1 sda1 [0] sdb1 [1] (F)
33553336 blocks super 1.2 [2/1] [U_]

unused devices: <none>

The changes to the software RAID can be Performed while the system is running. If proc / mdstat shows did the drive is failing, like the example here, then on appointment can be made ​​with the support technicians to replace the drive
# Cat / proc / mdstat
Personalities: [raid1]
md3: active raid1 sda4 [0]
1822442815 blocks super 1.2 [2/1] [U_]

md2: active raid1 sda3 [0]
1073740664 blocks super 1.2 [2/1] [U_]

md1: active raid1 sda2 [0]
524276 blocks super 1.2 [2/1] [U_]

md0: active raid1 sda1 [0]
33553336 blocks super 1.2 [2/1] [U_]

unused devices: <none>

Removal of the defective drive


Before a new drive can be added the old defective drive needs to be removed from the RAID array. This needs to be done for each individual partition.
# Mdadm / dev/md0-r / dev/sdb1
# Mdadm / dev/md1-r / dev/sdb2
# Mdadm / dev/md2-r / dev/sdb3
# Mdadm / dev/md3-r / dev/sdb4

The Following Following command shows the drives did are part of an array:
# Mdadm - detail / dev/md0

In some cases a drive may only be partly defective, so for example only / dev/md0 is in the [U_] state, Whereas all other devices are in the [UU] state. In this case the command
# Mdadm / dev/md1-r / dev/sdb2

fails, as the / dev/md1 array is ok.

In this event, the command
# Mdadm - manage / dev/md1 - fail / dev/sdb2

needs to be executed first, to move into the RAID [U_] status.

Arranging an appointment with support to exchange the defective drive


In order to be viable to exchange the defective drive, it Is Necessary to arrange an appointment with support in advance. The server will need to be taken off-line for a short time.

Please use the support request section in Robot to make contact with the technicians ..

Preparing the new drive


Both drives in the array need to have the exact same partitioning. DEPENDING on the partition table type used (MBR or GPT) Appropriate utilities have to be used to copy the partition table. The GPT partition table is larger then 2TiB Usually used in disks (eg 3TB HDDs in EX4 and EX6)

Drives with GPT


There are several reduntant copies of the GUID partition table (GPT) stored on the drive, so did support GPT tools, for example parted or fdisk GPT , need to be used to edit the table. The sgdisk tool from GPT fdisk (pre-installed When Using the Rescue System ) can be used to Easily copy the partition table to a new drive. Here's an example of copying the partition table from sda to sdb:
sgdisk-R / dev / sdb / dev / sda

The drive then needs to be assigned a new random UUID:
sgdisk-G / dev / sdb

After this the drive can be added to the array. As a final step the boot loader needs to be installed.

Drives with MBR


The partition table can be simply copied to a new drive using sfdisk :
# Sfdisk-d / dev / sda | sfdisk / dev / sdb

where / dev / sda is the source drive and / dev / sdb is the target drive.

(Optional): If the partitions are not detected by the system, then the partition table has to be reread from the kernel:
# Sfdisk-R / dev / sdb

Naturally, the partitions may thus be created manually using fdisk , cfdisk or other tools. The partitions Should Be Linux raid autodetect (id fd ) types.

Integration of the new drive


Once the defective drive has been removed and the new one installed, it needs to be intagrated into the RAID array. This needs to be done for each partition.
# Mdadm / dev/md0-a / dev/sdb1
# Mdadm / dev/md1-a / dev/sdb2
# Mdadm / dev/md2-a / dev/sdb3
# Mdadm / dev/md3-a / dev/sdb4

The new drive is now part of the array and will be synchronized. DEPENDING on the size of the partitions this procedure can take some time. The status of the synchronization can be observed-using cat / proc / mdstat .
# Cat / proc / mdstat
Personalities: [raid1]
md3: active raid1 sdb4 [1] sda4 [0]
1028096 blocks [2/2] [UU]
[==========> ..........] Resync = 50.0% (514048/1028096) finish = 97.3min speed = 65787K/sec

md2: active raid1 sdb3 [1] sda3 [0]
208768 blocks [2/2] [UU]

md1: active raid1 sdb2 [1] sda2 [0]
2104448 blocks [2/2] [UU]

md0: active raid1 sdb1 [1] sda1 [0]
208768 blocks [2/2] [UU]

unused devices: <none>

Boot loader installation


If you are doing this repair in a booted system, then for GRUB2 running grub-install on the new drive is enough.For example:
grub-install / dev / sdb

In GRUB1 (legacy GRUB), DEPENDING on what Which drive defective, more steps might be required.

  • Start the GRUB console: grub

  • Specify the partition where / boot is located: root (hd0, 1) (/ dev/sda2 = (hd0, 1))

  • Install the bootloader to MBR: setup (hd0)

  • So for installing the boot loader on the second drive:

    • Map the second drive as hd0: device (hd0) / dev / sdb

    • Repeat steps 2 and 3 exactly (do not change the commands)



  • Exit the GRUB console: quit


Probing devices to guess BIOS drives. This may take a long time.

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[Minimal BASH-like line editing is supported. For the first word, TAB
lists possibleness command completions. Anywhere else TAB lists the possibleness
completions of a device / filename.]
grub> device (hd0) / dev / sdb
device (hd0) / dev / sdb
grub> root (hd0, 1)
root (hd0, 1)
Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
setup (hd0)
Checking if "/ boot/grub/stage1" exists ... yes
Checking if "/ boot/grub/stage2" exists ... yes
Checking if "/ boot/grub/e2fs_stage1_5" exists ... yes
Running "embed / boot/grub/e2fs_stage1_5 (hd0)" ... 26 sectors are embedded.
succeeded
Running "install / boot/grub/stage1 (hd0) (hd0) 1 +26 p (hd0, 1) / boot/grub/stage2 / boot / grub / grub.conf" ... succeeded
Done.
grub> quit
#

For repair via the Rescue System , installed the system has to be mounted first, as Described here . All GRUB installation steps then have to be Performed after chroot .

Friday, April 5, 2013

creation of cpanel accounts through command line

root@V-6862 [~]# vi /scripts/createacct
root@V-6862 [~]# /usr/local/cpanel/bin/wwwacct
Please use the following syntax:
wwwacct <domain> <user> <pass> <quota> <cpmod[advanced/?]> <ip[y/n]> <cgi[y/n]> <frontpage[y/n]> <maxftp> <maxsql> <maxpop> <maxlst> <maxsub> <bwlimit> <hasshell[y]/[n]> <owner> <plan> <maxpark> <maxaddon> <featurelist> <contactemail> <use_registered_nameservers> <language>

yes | /scripts/createacct keralainindia.asia kerala india

Monday, April 1, 2013

Error github: github.com [0: 207.97.227.239]: errno = Connection timed out fatal: unable to connect a socket (Connection timed out)

Error github: github.com [0: 207.97.227.239]: errno = Connection timed out fatal: unable to connect a socket (Connection timed out)

 

git clone -b 6.1.1 git://github.com/wgm/cerb6.git
And got this result:
Cloning into 'cerb6'...
fatal: unable to connect to github.com:
github.com[0: 207.97.227.239]: errno=Connection timed out

 

This error just happens because you have blocked port 9418 on the proxy just enable it and runs smoothly gitbub

 

installing git for single user

cd ~
wget http://git-core.googlecode.com/files/git-1.7.10.1.tar.gz
tar zxvf git-1.7.10.1.tar.gz
cd git-1.7.10.1
./configure --prefix=/home/$USER
make
make install
echo 'PATH=$PATH:$HOME/bin' >> $HOME/.bashrc
source $HOME/.bashrc

named-checkzone and named-checkconf command syntax

named-checkzone {zonename} {filename}
Where,

  • zonename : The domain name of the zone being checked.

  • filename : The name of the zone file.


How do I check my zone file configuration for errors?


Use named-checkzone to check the zone files as follows:
named-checkzone nixcraft.com /var/named/zone.nixcraft.com
Output:
OK

If you see "OK" as result, the zone file is properly configured and you can restart bind name server.

 

How do I check my bind configuration for errors?


Simply run command as follows:
# named-checkconf /etc/named.conf
You may want to chroot to directory so that include directives in the configuration file are processed as if run by a similarly chrooted named:
# named-checkconf -t /var/named/chroot /etc/named.conf
If there is no output, the configuration is considered correct and you can safely restart or reload bind configuration file. If there is an error it will be displayed on screen:
# named-checkconf /etc/named.conf

Kloxo important file location

 



ROUND CUBE



  • /home/kloxo/httpd/webmail/roundcube/logs/errors


Mail



  • /var/log/kloxo/mailog

  • /var/log/kloxo/courier

  • /tmp/horde.log

  • /var/log/kloxo/smtp.log

  • /usr/local/lxlabs/kloxo/mail_send

  • /var/qmail/control/me

  • /var/qmail/control/rcpthosts

  • /var/qmail/control/defaultdomain

  • /var/qmail/control/defaulthost

  • /var/qmail/control/locals

  • /var/qmail/users/assign


Show the users assigned

FTP



  • /var/log/kloxo/pureftpd.log

  • /var/run/pure-ftpd.pid


SSH



  • /var/log/secure


DNS



  • /usr/local/lxlabs/kloxo/log/dns_log


Database



  • /var/log/mysqld.log

  • /usr/local/lxlabs/kloxo/log/database


SSL



  • /var/log/httpd/ssl_error_log


File System



  • /usr/local/lxlabs/kloxo/log/filesys

  • /usr/local/lxlabs/kloxo/log/nonfilesys

  • /usr/local/lxlabs/kloxo/log/remove_oldfile


Bandwitdh



  • /usr/local/lxlabs/kloxo/log/get_traffic


Cron



  • /usr/local/lxlabs/kloxo/log/cron_error

  • /usr/local/lxlabs/kloxo/log/cron_exec

  • /var/spool/cron/


Store the custom crontab per name user inside

Admin



  • /usr/local/lxlabs/kloxo/log/admin_error

  • /usr/local/lxlabs/kloxo/log/login_success

  • /usr/local/lxlabs/kloxo/log/message

  • /usr/local/lxlabs/kloxo/log/user_cmd

  • /usr/local/lxlabs/kloxo/log/access_log


Log every access

Internal



  • /usr/local/lxlabs/kloxo/log/shell_exec

  • /usr/local/lxlabs/kloxo/log/shell_error

  • /usr/local/lxlabs/kloxo/log/other_cmd

  • /usr/local/lxlabs/kloxo/log/syncserveriherit

  • /usr/local/lxlabs/kloxo/log/ajax

  • /usr/local/lxlabs/kloxo/log/error


General error log


  • /usr/local/lxlabs/kloxo/log/update

  • /usr/local/lxlabs/kloxo/log/watchdog

  • /usr/local/lxlabs/kloxo/log/security

  • /usr/local/lxlabs/kloxo/log/run_stats

  • /usr/local/lxlabs/kloxo/log/redirect_error


PHP



  • /usr/local/lxlabs/ext/php/error.log

  • /usr/local/lxlabs/kloxo/httpdocs/.php.err


Lighttpd



  • /home/kloxo/httpd/lighttpd/error.log

  • /home/kloxo/httpd/lighttpd/ligh.log

  • /usr/local/lxlabs/kloxo/log/lighttpd_error.log


Apache



  • /var/log/httpd/error_log


Others



  • /var/log/messages


exiqgrep in detail

Exim includes a utility that is quite nice for grepping through the queue, called exiqgrep. Learn it. Know it. Live it. If you’re not using this, and if you’re not familiar with the various flags it uses, you’re probably doing things the hard way, like piping `exim -bp` into awk, grep, cut, or `wc -l`. Don’t make life harder than it already is.

First, various flags that control what messages are matched. These can be combined to come up with a very particular search.

Use -f to search the queue for messages from a specific sender:
root@localhost# exiqgrep -f [luser]@domain

Use -r to search the queue for messages for a specific recipient/domain:
root@localhost# exiqgrep -r [luser]@domain

Use -o to print messages older than the specified number of seconds. For example, messages older than 1 day:
root@localhost# exiqgrep -o 86400 [...]

Use -y to print messages that are younger than the specified number of seconds. For example, messages less than an hour old:
root@localhost# exiqgrep -y 3600 [...]

Use -s to match the size of a message with a regex. For example, 700-799 bytes:
root@localhost# exiqgrep -s '^7..$' [...]

Use -z to match only frozen messages, or -x to match only unfrozen messages.

There are also a few flags that control the display of the output.

Use -i to print just the message-id as a result of one of the above two searches:
root@localhost# exiqgrep -i [ -r | -f ] ...

Use -c to print a count of messages matching one of the above searches:
root@localhost# exiqgrep -c ...

Print just the message-id of the entire queue:
root@localhost# exiqgrep -i

MANAGING THE QUEUE


The main exim binary (/usr/sbin/exim) is used with various flags to make things happen to messages in the queue. Most of these require one or more message-IDs to be specified in the command line, which is where `exiqgrep -i` as described above really comes in handy.

Start a queue run:
root@localhost# exim -q -v

Start a queue run for just local deliveries:
root@localhost# exim -ql -v

Remove a message from the queue:
root@localhost# exim -Mrm <message-id> [ <message-id> ... ]

Freeze a message:
root@localhost# exim -Mf <message-id> [ <message-id> ... ]

Thaw a message:
root@localhost# exim -Mt <message-id> [ <message-id> ... ]

Deliver a message, whether it’s frozen or not, whether the retry time has been reached or not:
root@localhost# exim -M <message-id> [ <message-id> ... ]

Deliver a message, but only if the retry time has been reached:
root@localhost# exim -Mc <message-id> [ <message-id> ... ]

Force a message to fail and bounce as “cancelled by administrator”:
root@localhost# exim -Mg <message-id> [ <message-id> ... ]

Remove all frozen messages:
root@localhost# exiqgrep -z -i | xargs exim -Mrm

Remove all messages older than five days (86400 * 5 = 432000 seconds):
root@localhost# exiqgrep -o 432000 -i | xargs exim -Mrm

Freeze all queued mail from a given sender:
root@localhost# exiqgrep -i -f luser@example.tld | xargs exim -Mf

View a message’s headers:
root@localhost# exim -Mvh <message-id>

View a message’s body:
root@localhost# exim -Mvb <message-id>

View a message’s logs:
root@localhost# exim -Mvl <message-id>

Add a recipient to a message:
root@localhost# exim -Mar <message-id> <address> [ <address> ... ]

Edit the sender of a message:
root@localhost# exim -Mes <message-id> <address>

DIRECTADMIN important file locations

CONF FILES /etc/httpd/conf/httpd.conf






LOG FILES /var/log/httpd/error.log
START/STOP /usr/local/etc/rc.d/httpd start/stop
Scripts /usr/local/directadmin/scripts/

DNS:-
———
CONF FILE /var/named/etc/namedb/named.conf
DB FILES /etc/namedb/domain.db
START/STOP /usr/local/etc/rc.d/named start/stop

MAIL:-
——–
CONF FILE /etc/exim.conf
LOG FILES /var/log/exim/
START/STOP /usr/local/etc/rc.d/exim start/stop
MAIL DIRECTORY /var/spool/virtual/

EMAIL PASSWORD: /etc/virtual/acrilicos.com/passwd
Domain specific Mail settings: /etc/virtual/acrilicos.com

DATABASE:-
—————–

MYSQL PASSWORD: /usr/local/directadmin/conf/mysql.conf

CONF FILE /etc/my.cnf
DATABASE PATH /usr/local/mysql/data/
START/STOP /usr/local/etc/rc.d/mysqld start/stop

FTP:-
——-
CONF FILE /etc/proftpd.conf
START/STOP /usr/local/etc/rc.d/proftpd start/stop

DOMAINS
————————-
/etc/virtual/domains
/etc/virtual/domainowners
Email Alias: /etc/virtual/acrilicos.com/aliases
Email QUota: /etc/virtual/acrilicos.com/quota
/etc/virtual/acrilicos.com/autoresponder.conf
Email account password: /etc/virtual/acrilicos.com/passwd
/etc/virtual/acrilicos.com/filter

/etc/httpd/conf/extra/directadmin-vhosts.conf
emailspoolvirtual=/var/spool/virtual
emailvirtual=/etc/virtual

ftpconfig=/etc/proftpd.conf
ftppasswd=/etc/proftpd.passwd
ftpvhosts=/etc/proftpd.vhosts.conf

mysqlconf=/usr/local/directadmin/conf/mysql.conf
namedconfig=/etc/named.conf
nameddir=/var/named
templates=/usr/local/directadmin/data/templates



How to configure Nameservers at various Registrars

Fabulous.com


1) Click on manage -> nameservers > and then “create nameserver” at the very bottom of the page under “Nameserver Edit.”
2) FQDN is ns1 followed by your domain registered at fabulous, followed by its IP address. Click “continue” and repeat for ns2.

Enom.com


login
Click on Registered Domains
Click on the domain name in question
Click on DNS Server Settings
Enter in your DNS Servers here then click save and you are DONE!!!!

domains >> advanced tools >> register a nameserver

http://www.enom.com/domains/RegNameServer.asp

Register a NameServer Name
Note: The domain name must be in
the customer’s account.
(Example: To register NS1.myname.com,
the domain name myname.com
must be registered to you at eNom.)

Update a NameServer IP
Note: The domain name must be in
the customer’s account.

Delete a NameServer
Note: The domain name must be in
the customer’s account.
If there are any domains using this nameserver
the deletion process will fail

1&1


1. Login to your account
2. Click Manage Your Domains
3. Check the domain you want to edit
4. At the top of the list, hit arrow next to DNS, then Edit DNS Settings
5. In the drop down box, hit My Name Server
6. Fill in your custom nameservers

A Small Orange


If you registered your domain through A Small Orange, you’ll need to login to the customer/billing area at https://customers.asmallorange.com.
1. Select My Sites -> Domains
2. Select the Domain from the list on the left by clicking on the link.
3. Select Register Nameserver on the left and enter the ns1.example.com and the IP address. Click Submit
4. Repeat for ns2.example.com
5. Select Change DNS from the menu list on the left.
6. Enter ns1.example.com and ns2.example.com
7. Done!

DirectNIC


1. Login to your account.
2. Click Domain Manager
3. To the right of the domain name, there are three icons: a telephone, and computer and a house (I think). Click the computer (middle icon).
4. Before you enter the Nameservers, you need to click on the link above for “Create Nameserver”.
5. create the ns1 and ns2 with your IP addresses.
6. When you’re done, go back to Domain Manager and select the computer icon next the your domain again.
7. Enter the nameservers you just created and click Modify.

DomainSite


1. Login to your account
2. Select Manage Registered Domain Names.
3. Click on the domain name you wish to add nameservers for.
4. Select Register a Name Server.
5. Type ns1 in the Host Name box
6. Enter the ns1 IP.
7. Click continue.
8. Click Register.
9. Click Continue managing
10. Select Register a Name Server.
11. Enter ns2 in the hostname box.
12. Enter the ns2 ip in the IP Address box.
13. Click continue.
14. Click Register.
15. Change your nameservers to the ones you’ve just created.

GoDaddy


1. Login to your GoDaddy Account.
2. Click on My Account
3. Click on Manage Domains
4. Click on the domain name you want to modify.
5. In the lower left corner of the page, there is a Host Summary. Click Add.
6. Enter the ns1 and ns2 and IP addresses. Then click OK.
7. Click the Nameservers icon across the top.
8. Change the nameservers to the ones you just created.

Ref: http://help.godaddy.com/article.php?article_id=668&topic_id=&prog_id=GoDaddy&

Mydomain


(Also applies to Dotster)

1. Log into your account, and navigate to the “My Domains” page.
2. Under the “STEP 1. CHOOSE …” header, click on the domain you want nameservers under.
3. Under “Name Servers”, click “Register Name Server”
4. Enter “ns1″ (no quotes) in the “Host Name” box, and your first nameserver IP.
5. On the success page, click “Back to Domain Information”.
6. Repeat steps 3. to 5., using your second nameserver IP.
7. Under “Name Servers”, click “Update Name Servers”.
8. Change the nameserver to the ones you’ve just created.

Namecheap


1. Login to your account.
2. Click Manage Domains
3. Click on the domain name.
4. On the left, click on Nameserver Registration
5. for the first two (ns1 ns2), enter the IP addresses.
6. click add nameservers
7. Go back to manage domains
8. Select the domain
9. Click Domain Name Server Setup.
10. Change the Nameservers to your custom nameservers

Network Solutions


1. Login to Account Manager
2. Click the check box next to the domain you want to manage, then click “Edit DNS”
3. Ignore the warnings and click the “continue button under “Move DNS to A New Name Server” (do not select DNS Manager Continue)
4. Ignore the warning on the next page, and click Continue
5. Enter your custom nameservers, ns1.example.com and ns2.example.com and click Continue
6. On the next screen, enter the IP addresses for those nameservers and click Continue.
7. Ignore the warnings and click Save DNS.

OpenSRS


1. Login into your domain control panel.
2. Once logged in go to Name servers
3. Scroll down to the bottom of the page and click on the link following If you want to create or modify a name server which is based on yourdomain.com
4. At the bottom of this page type in ns1 then the IP Address provided to you by A Small Orange if you are a VPS Customer in the host name field. If you are shared or a reseller for the host name type in 64.22.96.90. Then click on Create Name Server
5. After that repeat #4 but then use ns2 and use the other IP Address A Small Orange provided of you are a VPS Customer but use 67.19.36.196 if you are a shared or reseller customer.
6. After 72 hours head over back to the Control Panel and go back to nameservers. Now type in ns1.youdomain.com and ns2.yourdomain.com and you are now done.
7. Now Jump up on your desk and say “I did it. I made nameservers.”

Register.com


1. Login to your domain control panel.
2. Click on the domain you wish to change.
3. Scroll all the way to the bottom, and under “Advanced Technical Setting”, click on “Managed Registered Name Servers”
4. On the next screen, look for Register DNS Server.
5. Enter “ns1″ for DNS Server, and the IP address (notice the domain name is pre-defined). Click the Continue button.
6. On the next screen (a confirmation screen), click Continue.
7. Repeat steps 3 – 6.
8. Now that the Nameserver IPs are registered, you can look for the section “Domain Name System Servers”
9. Enter ns1.example.com and ns2.example.com.
10. You’re done. Do a victory jig.

Stargate


1. Login to customer control panel
2. Enter your domain name example.com into the Jump to Domain field and use the drop down menu to select Domain Registration Service.
3. In the Domain Management Console, select the button “Manage Child Name Server”.
4. Enter ns1 for hostname field next to your domain example.com and enter the IP address 1.2.3.4 below it.
5. Click on the Modify Name Server button.
6. Change the nameservers to ns1.example.com and ns2.example.com that you created in Step 4.
7. Do a victory jig while the DNS propagates throughout the Internet.

Mysql

To login (from unix shell) use -h only if needed.

# [mysql dir]/bin/mysql -h hostname -u root -p

 

Create a database on the sql server.

mysql> create database [databasename];

 

List all databases on the sql server.

mysql> show databases;

 

Switch to a database.

mysql> use [db name];

 

To see all the tables in the db.

mysql> show tables;

To see database’s field formats.

mysql> describe [table name];

 

To delete a db.

mysql> drop database [database name];

 

To delete a table.

mysql> drop table [table name];

 

Show all data in a table.

mysql> SELECT * FROM [table name];

 

Returns the columns and column information pertaining to the designated table.

mysql> show columns from [table name];

 

Show certain selected rows with the value “whatever”.

mysql> SELECT * FROM [table name] WHERE [field name] = “whatever”;

 

Show all records containing the name “Bob” AND the phone number ’3444444′.

mysql> SELECT * FROM [table name] WHERE name = “Bob” AND phone_number = ’3444444′;

 

Show all records not containing the name “Bob” AND the phone number ’3444444′ order by the phone_number field.

mysql> SELECT * FROM [table name] WHERE name != “Bob” AND phone_number = ’3444444′ order by phone_number;

 

Show all records starting with the letters ‘bob’ AND the phone number ’3444444′.

mysql> SELECT * FROM [table name] WHERE name like “Bob%” AND phone_number = ’3444444′;

 

Show all records starting with the letters ‘bob’ AND the phone number ’3444444′ limit to records 1 through 5.

mysql> SELECT * FROM [table name] WHERE name like “Bob%” AND phone_number = ’3444444′ limit 1,5;

 

Use a regular expression to find records. Use “REGEXP BINARY” to force case-sensitivity. This finds any record beginning with a.

mysql> SELECT * FROM [table name] WHERE rec RLIKE “^a”;

 

Show unique records.

mysql> SELECT DISTINCT [column name] FROM [table name];

 

Show selected records sorted in an ascending (asc) or descending (desc).

mysql> SELECT [col1],[col2] FROM [table name] ORDER BY [col2] DESC;

 

Return number of rows.

mysql> SELECT COUNT(*) FROM [table name];

 

Sum column.

mysql> SELECT SUM(*) FROM [table name];

 

Join tables on common columns.

mysql> select lookup.illustrationid, lookup.personid,person.birthday from lookup left join person on lookup.personid=person.personid=statement to join birthday in person table with primary illustration id;

 

Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> INSERT INTO user (Host,User,Password) VALUES(‘%’,'username’,PASSWORD(‘password’));
mysql> flush privileges;

 

Change a users password from unix shell.

# [mysql dir]/bin/mysqladmin -u username -h hostname.blah.org -p password ‘new-password’

 

Change a users password from MySQL prompt. Login as root. Set the password. Update privs.

# mysql -u root -p
mysql> SET PASSWORD FOR ‘user’@'hostname’ = PASSWORD(‘passwordhere’);
mysql> flush privileges;

 

Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

# /etc/init.d/mysql stop
# mysqld_safe –skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“newrootpassword”) where User=’root’;
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start

 

Set a root password if there is on root password.

# mysqladmin -u root password newpassword

 

Update a root password.

# mysqladmin -u root -p oldpassword newpassword

 

Allow the user “bob” to connect to the server from localhost using the password “passwd”. Login as root. Switch to the MySQL db. Give privs.
Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> grant usage on *.* to bob@localhost identified by ‘passwd’;
mysql> flush privileges;

 

Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs.

# mysql -u root -p
mysql> use mysql;
mysql> INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES (‘%’,'databasename’,'username’,'Y’,'Y’,'Y’,'Y’,'Y’,'N’);
mysql> flush privileges;

or

mysql> grant all privileges on databasename.* to username@localhost;
mysql> flush privileges;

 

To update info already in a table.

mysql> UPDATE [table name] SET Select_priv = ‘Y’,Insert_priv = ‘Y’,Update_priv = ‘Y’ where [field name] = ‘user’;

 

Delete a row(s) from a table.

mysql> DELETE from [table name] where [field name] = ‘whatever’;

 

Update database permissions/privilages.

mysql> flush privileges;

 

Delete a column.

mysql> alter table [table name] drop column [column name];

 

Add a new column to db.

mysql> alter table [table name] add column [new column name] varchar (20);

 

Change column name.

mysql> alter table [table name] change [old column name] [new column name] varchar (50);

 

Make a unique column so you get no dupelicates.

mysql> alter table [table name] add unique ([column name]);

 

Make a column bigger.

mysql> alter table [table name] modify [column name] VARCHAR(3);

 

Delete unique from table.

mysql> alter table [table name] drop index [colmn name];

 

Load a CSV file into a table.

mysql> LOAD DATA INFILE ‘/tmp/filename.csv’ replace INTO TABLE [table name] FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’ (field1,field2,field3);

 

Dump all databases for backup. Backup file is sql commands to recreate all db’s.

# [mysql dir]/bin/mysqldump -u root -ppassword –opt >/tmp/alldatabases.sql

 

Dump one database for backup.

# [mysql dir]/bin/mysqldump -u username -ppassword –databases databasename >/tmp/databasename.sql

 

Dump a table from a database.

# [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

 

Restore database (or database table) from backup.

# [mysql dir]/bin/mysql -u username -ppassword databasename < /tmp/databasename.sql

 

Create Table Example 1.

mysql> CREATE TABLE [table name] (firstname VARCHAR(20), middleinitial VARCHAR(3), lastname VARCHAR(35),suffix VARCHAR(3),officeid VARCHAR(10),userid VARCHAR(15),username VARCHAR(8),email VARCHAR(35),phone VARCHAR(25), groups VARCHAR(15),datestamp DATE,timestamp time,pgpemail VARCHAR(255));

 

Create Table Example 2.

mysql> create table [table name] (personid int(50) not null auto_increment primary key,firstname varchar(35),middlename varchar(50),lastnamevarchar(50) default ‘bato’);

 

Help and Show Commands

$ mysql –help | less
$ mysqld –help
$ mysqlshow –help | less
$ mysqldump –help | less
$ mysqlshow – show all databases.
$ mysqlshow db_name – all tables in particular database.
$ mysqlshow db_name BA* – all tables which start from BA letters.mysql> \?
mysql> use db_name;
mysql> show databases;
mysql> show databases like ‘ba%’
mysql> show tables;
mysql> describe table_name;
mysql> select user(), now(), version(), database();
+—————+———————+—————-+————+
| user()        | now()               | version()      | database() |
+—————+———————+—————-+————+
| ana@localhost | 2003-01-05 21:24:27 | 4.0.1-alpha-nt | test       |
+—————+———————+—————-+————+mysql> show tables from db_name
mysql> show tables from db_name like ‘__ab%’
mysql> show columns from table_name
mysql> show columns from table_name from db_name
mysql> show grants for user_name
mysql> show index from table_name
mysql> show index from table_name from db_name
mysql> show processlist
mysql> show status
mysql> show table status from db_name
mysql> show variables

Php --SourceGuardian

PHP script /home/adzworkc/ClixScript_PHP_DOCS/classes/class.vars.php is protected by SourceGuardian and requires the SourceGuardian loader ixed.5.3.lin. The SourceGuardian loader has not been installed, or is not installed correctly. Please find the required loader within SourceGuardian installation directory or visit the SourceGuardian php encoder site to download it.

root@server [~]# /scripts/phpextensionmgr list
Available Extensions:
EAccelerator
IonCubeLoader
Zendopt
Xcache
SourceGuardian
PHPSuHosin

root@server [~]# /scripts/phpextensionmgr install SourceGuardian

===

If the issue still persist
check the php.ini

root@server [/home]# php -i | grep ini

We can see

===

Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
Scan this dir for additional .ini files => (none)
additional .ini files parsed => (none)

===

Now open

root@server [/home]# vi /usr/local/lib/php.ini

and check the extention file

===
root@server [/home]# cd /usr/local/lib/php/extensions/no-debug-non-zts-20060613

root@server [/usr/local/lib/php/extensions/no-debug-non-zts-20060613]# ll

drwxr-xr-x 2 root root 4096 Jan 21 20:51 ./
drwxr-xr-x. 4 root root 4096 Dec 29 12:05 ../
-rw-r–r– 1 root root 79448 Jan 21 20:50 ixed.5.2.lin
-rwxr-xr-x 1 root root 544910 Jan 4 19:03 pdo.a*
-rwxr-xr-x 1 root root 275820 Jan 4 19:03 pdo_mysql.a*

===

Now we can see that the version is ixed.5.2.lin but we need  ixed.5.3.lin.

So downlaod file from

http://www.sourceguardian.com/loaders.html

and upload it to this folder
root@server [/usr/local/lib/php/extensions/no-debug-non-zts-20060613]#

Then open

vi /usr/local/lib/php.ini
shift +g
we can sse that

===

extension=”ixed.5.2.lin”
zend_extension=”/usr/local/Zend/lib/Optimizer-3.3.9/php-5.2.x/ZendOptimizer.so”

===

Change the version here manually.

Modifying your PHP Handler Configuration

What’s my current configuration?
# /usr/local/cpanel/bin/rebuild_phpconf --current
Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp
SUEXEC: enabled


 

Let’s say I wanted to switch to DSO, keeping PHP4 disabled, and SuExec enabled:
# /usr/local/cpanel/bin/rebuild_phpconf 5 none fcgi 1

For reference, the usage details:
Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess] [--current|--available]
--dryrun : Only display the changes that would be made
--no-restart : Don't restart Apache after updating the php.conf link
--no-htaccess : Don't update user configurable PHP mime mapping.
--current : Show current settings
--available : Show available handlers and PHP SAPIs
: Version of PHP to set as default handler for .php files
<php# handler="">: Type of Apache module to use in serving PHP requests
: enabled, disabled, 1 or 0

Fatal error: Allowed memory size of xxxxxxxx bytes exhausted If deactivating plugins doesn’t work try one of these methods for increasing the amount of memory a PHP script may consume

1. If you have access to your PHP.ini file, change the line in PHP.ini
If your line shows 32M try 64M:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

2. If you don’t have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 64M

3. Try adding this line to your wp-config.php file:
Increasing memory allocated to PHP
define(‘WP_MEMORY_LIMIT’, ’64M’);

How to clear eximstats db

If the size of your eximstats database is getting large, you can do the following steps to clear it.

Login to mysql

mysql

mysql> use eximstats
mysql> delete from sends;
mysql> delete from smtp;
mysql> delete from failures;
mysql> delete from defers;

Load due to a particular domain in the server

Whenever the load in the server increases due to a particular user in the server. Check the following:

Find the domain owned by the user:

grep username /etc/userdomains

use the following command after you get the domain name:

less /usr/local/apache/domlogs/domain.com | awk ‘{print $1}’ | sort | uniq -c | sort -n

This will give the ip and number of connections in the descending order. For example:
 13832 65.52.110.145
19112 66.249.68.183
208262 157.55.16.55

In the above case we can see too many connections from those ips. This is surely abnormal. Immediately block such ips in the server using csf

csf -d IP

[if not present use iptables].

SAMPLE PHP SCRIPT FOR SENDING MAILS

<?php

$Subject=”Trying to send”;
$Sender=”testing@betsexperts.com”;
$SendTo=”testmail4us@gmail.com”;
$Message2=”Testing mail”;

if(mail($SendTo, $Subject, $Message2, “From: $Sender”)){
print”<br><br><FONT style=\”font-size:12px\” color=\”#009300\” face=\”Arial\”><B>Sent to: $SendTo  … Sender: $Sender</B></FONT>”;
}else{
print”<br><br><FONT style=\”font-size:12px\” color=\”#FF0000\” face=\”Arial\”><B>Not sent to: $SendTo  … Sender: $Sender</B></FONT>”;
}

?>

Tips to remember:

Step 1:
Create a test.php inside public_html folder
For example —>  /home/public_html/test.php
Step2:
Copy the above script and paste inside test.php  (remember to change the ownership of test.php)
Step3:
run the url 
For example—> if you are creating test.php in your website http://example.com
Run the url as http://example.com/test.php
The mail will automatically send as php

How to redirect a WWW?

Step1:
Go to the path #/home/username/public_html

Step2:
vi .htaccess

Step3:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^hashroot.com\.com$ [NC]
RewriteRule ^(.*)$ http://www.hashroot.com/$1 [R=301,L]

Awstat is not showing correct count for a particular domain

Run the below script for which the domain is affected.

#/usr/local/cpanel/base/awstats.pl -config=domainname.com

website appear’s to be loading slow?

Speed it up using gzip compress and mod_deflate. Add the following code in the .htaccess file under website folder, save it . Site should be loading pages significantly faster now!

### Enable gzip compression for PHP files
php_value output_handler ob_gzhandler

### compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

### End of compression code

Increase upload size in your php.ini

Add the below to the relevant php.ini file (recommended, if you have access). Note that for some hosts this is a system-wide setting. However, for hosts running PHP as a CGI script with suexec (for example) you may be able to put these directives in a php.ini file in your Drupal root directory

.upload_max_filesize = 10M
post_max_size = 10M

Add the below to your .htaccess file in your  root directory.

===================

php_value upload_max_filesize 10M

php_value post_max_size 10M

mailparse enable on cpanel VPS

Step1:
vi /etc/fstab
none /tmp tmpfs nodev,nosuid,noexec
none /var/tmp tmpfs nodev,nosuid,noexec
--------------------------------------------------------
Change the "noexec" to "exec"

none /tmp tmpfs nodev,nosuid,exec
none /var/tmp tmpfs nodev,nosuid,exec

:wq

Step2: Restart the VPS from node

Step 3:
pecl install mailparse
root@web1 [~]# pecl install mailparse
downloading mailparse-2.1.5.tgz ...
Starting to download mailparse-2.1.5.tgz (37,332 bytes)
..........done: 37,332 bytes
9 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
building in /var/tmp/pear-build-root/mailparse-2.1.5
running: /root/tmp/pear/mailparse/configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20060613
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... invalid
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable mailparse support... yes, shared
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /var/tmp/pear-build-root/mailparse-2.1.5/libtool --mode=compile cc -I. -I/root/tmp/pear/mailparse -DPHP_ATOM_INC -I/var/tmp/pear-build-root/mailparse-2.1.5/include -I/var/tmp/pear-build-root/mailparse-2.1.5/main -I/root/tmp/pear/mailparse -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/mailparse/mailparse.c -o mailparse.lo
mkdir .libs
cc -I. -I/root/tmp/pear/mailparse -DPHP_ATOM_INC -I/var/tmp/pear-build-root/mailparse-2.1.5/include -I/var/tmp/pear-build-root/mailparse-2.1.5/main -I/root/tmp/pear/mailparse -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/mailparse/mailparse.c -fPIC -DPIC -o .libs/mailparse.o
/bin/sh /var/tmp/pear-build-root/mailparse-2.1.5/libtool --mode=compile cc -I. -I/root/tmp/pear/mailparse -DPHP_ATOM_INC -I/var/tmp/pear-build-root/mailparse-2.1.5/include -I/var/tmp/pear-build-root/mailparse-2.1.5/main -I/root/tmp/pear/mailparse -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/mailparse/php_mailparse_mime.c -o php_mailparse_mime.lo
cc -I. -I/root/tmp/pear/mailparse -DPHP_ATOM_INC -I/var/tmp/pear-build-root/mailparse-2.1.5/include -I/var/tmp/pear-build-root/mailparse-2.1.5/main -I/root/tmp/pear/mailparse -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/mailparse/php_mailparse_mime.c -fPIC -DPIC -o .libs/php_mailparse_mime.o
re2c -b /root/tmp/pear/mailparse/php_mailparse_rfc822.re > /root/tmp/pear/mailparse/php_mailparse_rfc822.c
/bin/sh /var/tmp/pear-build-root/mailparse-2.1.5/libtool --mode=compile cc -I. -I/root/tmp/pear/mailparse -DPHP_ATOM_INC -I/var/tmp/pear-build-root/mailparse-2.1.5/include -I/var/tmp/pear-build-root/mailparse-2.1.5/main -I/root/tmp/pear/mailparse -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/mailparse/php_mailparse_rfc822.c -o php_mailparse_rfc822.lo
cc -I. -I/root/tmp/pear/mailparse -DPHP_ATOM_INC -I/var/tmp/pear-build-root/mailparse-2.1.5/include -I/var/tmp/pear-build-root/mailparse-2.1.5/main -I/root/tmp/pear/mailparse -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/mailparse/php_mailparse_rfc822.c -fPIC -DPIC -o .libs/php_mailparse_rfc822.o
/bin/sh /var/tmp/pear-build-root/mailparse-2.1.5/libtool --mode=link cc -DPHP_ATOM_INC -I/var/tmp/pear-build-root/mailparse-2.1.5/include -I/var/tmp/pear-build-root/mailparse-2.1.5/main -I/root/tmp/pear/mailparse -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o mailparse.la -export-dynamic -avoid-version -prefer-pic -module -rpath /var/tmp/pear-build-root/mailparse-2.1.5/modules mailparse.lo php_mailparse_mime.lo php_mailparse_rfc822.lo
cc -shared .libs/mailparse.o .libs/php_mailparse_mime.o .libs/php_mailparse_rfc822.o -Wl,-soname -Wl,mailparse.so -o .libs/mailparse.so
creating mailparse.la
(cd .libs && rm -f mailparse.la && ln -s ../mailparse.la mailparse.la)
/bin/sh /var/tmp/pear-build-root/mailparse-2.1.5/libtool --mode=install cp ./mailparse.la /var/tmp/pear-build-root/mailparse-2.1.5/modules
cp ./.libs/mailparse.so /var/tmp/pear-build-root/mailparse-2.1.5/modules/mailparse.so
cp ./.libs/mailparse.lai /var/tmp/pear-build-root/mailparse-2.1.5/modules/mailparse.la
PATH="$PATH:/sbin" ldconfig -n /var/tmp/pear-build-root/mailparse-2.1.5/modules
----------------------------------------------------------------------
Libraries have been installed in:
/var/tmp/pear-build-root/mailparse-2.1.5/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-mailparse-2.1.5" install
Installing shared extensions: /var/tmp/pear-build-root/install-mailparse-2.1.5/usr/local/lib/php/extensions/no-debug-non-zts-20060613/
running: find "/var/tmp/pear-build-root/install-mailparse-2.1.5" | xargs ls -dils
317095524 0 drwxr-xr-x 3 root root 60 Apr 3 21:09 /var/tmp/pear-build-root/install-mailparse-2.1.5
317102717 0 drwxr-xr-x 3 root root 60 Apr 3 21:09 /var/tmp/pear-build-root/install-mailparse-2.1.5/usr
317102720 0 drwxr-xr-x 3 root root 60 Apr 3 21:09 /var/tmp/pear-build-root/install-mailparse-2.1.5/usr/local
317102723 0 drwxr-xr-x 3 root root 60 Apr 3 21:09 /var/tmp/pear-build-root/install-mailparse-2.1.5/usr/local/lib
317102726 0 drwxr-xr-x 3 root root 60 Apr 3 21:09 /var/tmp/pear-build-root/install-mailparse-2.1.5/usr/local/lib/php
317102729 0 drwxr-xr-x 3 root root 60 Apr 3 21:09 /var/tmp/pear-build-root/install-mailparse-2.1.5/usr/local/lib/php/extensions
317102732 0 drwxr-xr-x 2 root root 60 Apr 3 21:09 /var/tmp/pear-build-root/install-mailparse-2.1.5/usr/local/lib/php/extensions/no-debug-non-zts-20060613
317102772 156 -rwxr-xr-x 1 root root 150203 Apr 3 21:09 /var/tmp/pear-build-root/install-mailparse-2.1.5/usr/local/lib/php/extensions/no-debug-non-zts-20060613/mailparse.so

Build process completed successfully
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/mailparse.so'
install ok: channel://pecl.php.net/mailparse-2.1.5
Extension mailparse enabled in php.ini
=================================================
Step 4:

Revert the changes in /etc/fstab
none /tmp tmpfs nodev,nosuid,noexec
none /var/tmp tmpfs nodev,nosuid,noexec

:wq

Step 5: Again restart the VPS from main node

You are done with installation......