Pages

Bài đăng phổ biến

Wednesday, November 30, 2011

How to backup ispconfig

1.
mkdir /home/backup chmod 700 /home/backup cd /home/backup
2.
mysqldump -u root -p dbispconfig > dbispconfig.sql
3.
tar pcfz ispconfig_software.tar.gz /root/ispconfig
4.
tar pcfz etc.tar.gz /etc


notice:This backup does not include the emails and website data.


(faqforge.)

Template for php

Easy Template System
http://ets.sourceforge.net/

Smarty
http://smarty.php.net/


FastTemplate
http://www.thewebmasters.net/php/FastTemplate.phtml


bTemplate
http://www.massassi.com/bTemplate/


ModeliXe
http://modelixe.phpedit.com/


UltraTemplate
http://www.ultratemplate.com/main.php


PHPTemplate
http://nutbar.chemlab.org/


PHPLib
http://sourceforge.net/projects/phplib


XTemplate
http://sourceforge.net/projects/xtpl/


SmartTemplate
http://www.smartphp.net/content/smar...out/about.html


Yapster
http://yapter.sourceforge.net/
PHP Classes
http://www.phpclasses.org/browse.html/class/37.html

Zend template
https://www.zend.com/codex.php?CID=332

SledgeHammer
http://sledgehammer.sourceforge.net/


PHPtemplater
http://www.jmcresearch.com/src/proje...tion=view&id=4


phpSavant
http://phpsavant.com/


SmashTemplate
http://www.phpclasses.org/browse.html/class/1401.html


{PHPTMPL}
http://www.lri.fr/~gk/PHPTMPL/

AwesomeTemplateEngine
http://www.pinkgoblin.com/index.php?view=scripts


Virtual Template
http://sourceforge.net/projects/vtemplate/


TemplateTamer
http://www.templatetamer.org

QuickTemplate
http://www.phpclasses.org/browse.html/package/49


Phemplate
http://pukomuko.esu.lt/phemplate/


Templates engine for PHP
http://sourceforge.net/projects/php-templates


YATS
http://yats.sourceforge.net


iTemplate
http://sourceforge.net/projects/itemplate


Cached Fast Template
http://zoned.net:8000/~xkahn/php/fasttemplate/


AvanTemplate
http://avantemplate.sourceforge.net/


PHPWidgets
http://www.northern.ca/projects/phpwidgets

(internet)

Zend studio: Errors occurred during the build. Errors running builder 'JavaScript Validator' on project 'PROJECT'. java.lang.NullPointerException

Problem:


Errors occurred during the build. Errors running builder 'JavaScript Validator' on project 'PROJECT'. java.lang.NullPointerException


Resolution:


you must go to Project->Properties->Builders then disable ‘Javascript Validator’.


Nguyễn Sĩ Nhàn

How do I sync data between two Load balanced Windows 2003 servers?


For UNIX/Linux server you can use rsync command to keep data sync'd between two servers. rsync also works under Windows NT/2003 server but it will take lots of time to setup.
For Microsoft Windows 2003 server use robocopy tool, to sync files between two windows server. You can download robocopy.exe and other files from Windows 2003 Resource Kit Tools set.
Once tool is downloaded, install the Resource Kit. By default robocopy located at c:\Program Files\Windows Resource Kits\Tools\robocopy.exe. Now let us assume that you want to sync d:\Inetpub\wwwroot\ directory between two Windows server. First create hidden share on www2 (secondary server)
  1. Login to www2
  2. Select d:\Inetpub\wwwroot\
  3. Right click > Properties > Sharing tab > Share this folder > Add $ at the end of share name and save the changes.

How do I use robocopy command?

=> Login to primary server (www1)
=> Click on stat > run > type cmd
=> At command prompt type command:
c:>"c:\program files\windows resource kits\tools\robocopy.exe d:\inetpub\wwwroot www2\\inetpub\wwwroot\"ALTERNATIVELY, use IP address of www2 server :
c:>"c:\program files\windows resource kits\tools\robocopy.exe d:\inetpub\wwwroot 202.54.10.200\\inetpub\wwwroot\"robocopy has many more options and lots of other information available in Robocopy.DOC file.
(cyberciti)

How to sync data between 2 servers automatically


Have you ever wanted to know how to easily synchronize the data between multiple servers automatically?

In this article I’ll explain how to setup 2 Linux servers to automatically synchronize data between a specific directory on each server. To do this we will use rsync, ssh key authentication, and a cron job.
Let’s call the 2 servers ‘SOURCESERVER’ and ‘DESTSERVER’ for
SOURCESERVER = Source server (the server we’re connecting from to upload the data)
DESTSERVER = Destination server (the server we’re connecting to receive the data)

Part 1 - Setting up SSH key authentication

First, we need to make sure the DESTSERVER has the ability to use key authentication enabled. Find your sshd configuration file (usually ‘/etc/ssh/sshd_config’) and enable the following options if they are not already set.
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

If you edit the file be sure to restart sshd afterwards.
# /etc/init.d/sshd restart
Next, on the SOURCESERVER we will create the public / private key pair to be used for authentication with the following command.
# ssh-keygen -t rsa
*Note: Do not enter a passphrase for this, just hit enter when prompted.
This should create 2 files, a public key file and a private key file.
The public key file (usually [homedir]/.ssh/id_rsa.pub) we will upload to the DESTSERVER.
The private key file (usually [homedir]/.ssh/id_rsa) we will keep on the SOURCESERVER.
*Be sure to keep this private key safe. With it anyone will be able to connect to the DESTSERVER that contains the public key.
Now we will plant the public key we created on to the DESTSERVER.
Choose the user account which you will use to connect to on DESTSERVER, we’ll call this user ‘destuser’ for now.
In that account’s home directory, create a ‘.ssh’ subdirectory, and in that directory create a new text file called ‘authorized_keys’. If it already exists, great, use the existing file.
Open the ‘authorized_keys’ file and paste in the contents of the public key you created in the previous step (id_rsa.pub). It should look something like the following
ssh-rsa <lots and lots of characters…> sourceuser@SOURCESERVER
Save the file and change the permissions to 600 for the file and 700 for the ‘.ssh’ directory.
Now to test that the keys are working.
From the SOURCESERVER try logging in as normal using ssh to the DESTSERVER.
# ssh destuser@DESTSERVER
If all is working you should not be prompted for a password but instead connected directly to a shell on the DESTSERVER.

Part 2 - Creating the rsync script

Now for the rsync script.
I use a simple script such as the following
——————————————-
#!/bin/bash
SOURCEPATH=’/source/directory’
DESTPATH=’/destination’
DESTHOST=’123.123.123.123′
DESTUSER=’destuser’
LOGFILE=’rsync.log’
echo $’\n\n’ >> $LOGFILE
rsync -av –rsh=ssh $SOURCEPATH $DESTUSER@$DESTHOST:$DESTPATH 2>&1 >> $LOGFILE
echo “Completed at: `/bin/date`” >> $LOGFILE
——————————————-
Copy this file into the home directory of the sourceuser on the SOURCESERVER
and modify the first 4 variables in the file.
SOURCEPATH (Source path to be synced)
DESTPATH (Destination path to be synced)
DESTHOST (Destination IP address or host name)
DESTUSER (User on the destination server)
Save it as something like ‘rsync.sh’
Set the permissions on the file to 700.
# chmod 700 rsync.sh
Now you should be able to run the script, have it connect to the DESTSERVER, and transfer the files all without your interaction.
The script will send all output to the ‘rsync.log’ file specified in the script.

Part 3 - Setting up the cron job

Assuming everything has worked so far all that’s left is to setup a cron job to run the script automatically at a predefined interval.
As the same sourceuser use the ‘crontab’ command to create a new cron job.
# crontab -e
This will open an editor where you can schedule the job.
Enter the following to have the script run once every hour
——————————————-
# Run my rsync script once every hour
0 * * * * /path/to/rsync.sh
——————————————-
Your 2 servers should now be syncing the chosen directory once every hour.
Hope this helped, let me know if you have any questions.

(howtomonster.)

Tuesday, November 29, 2011

Cpanel : A fatal error has occurred DB Error: connect failed


Problem happen when password of database in file config difference with current password  of database horde.

Resolution: Change current password to same password in file config of horde.

/usr/local/cpanel/base/horde/config/conf.php
$conf['sql']['username'] = 'horde';
$conf['sql']['password'] = 'xxxxxxx';


mysql> UPDATE mysql.user SET Password=PASSWORD('YOUR-NEW-MYSQL-PASSWORD') WHERE User='horde';
mysql> FLUSH PRIVILEGES;
mysql> exit
 Nguyễn Sĩ Nhàn
 


Monday, November 28, 2011

While executing onLoad in _afterSave.htm, a JavaScript error occurred.

Resolution:
1. Stop dreamwaver
2. go to drive:\documents and settings\username\application
data\Adobe\Dreamweaver x\

Rename folder configuration to configuration.bak
3. Start dreamwaver again is OK , That's all.

Nguyen Si Nhan

Saturday, November 26, 2011

*Exception Details: *System.Data.SqlClient.SqlException: Login failed for user


*Exception Details: *System.Data.SqlClient.SqlException: Login failed for
user 'SIN2\Iusr_7503870'.



Resolution:


Open file web.config delete these character:


Integrated Security=SSPI


And then save your file ,Now It 'll run OK.Done.


Nguyen Si Nhan

Friday, November 25, 2011

How to remove email assigned from queue mail - Exim

# grep -lir <string> /var/spool/exim/input/* | xargs rm -fv
examples:
# grep -lir sales\@domain\.com /var/spool/exim/input/* | xargs rm -fv

Nguyen Si Nhan

Wednesday, November 23, 2011

Thursday, November 17, 2011

[Resolved] Warning: Cannot modify header information - headers already sent by

When you see this error, you just put this tiny code to begin your code:
Go Daddy $7.49 .com Sale!

 ob_start()           turn on  buffer
 ob_end_flush()   turn off buffer and print all to browser


Example:

<?php

ob_start(); 

echo "Check phat";
header("Location: redirect.php");
ob_end_flush(); 
?>
Nguyen Si Nhan

Cpanel: Export email account to file

1. Use an editor to create new file with below content set with name getAllEmail.awk:

#!/bin/awk -f
#
# File: getAllEmail.awk
#
# This awk script takes the input of ls -d /home/*/mail/*/*
# checks to see if the directory exists, then outputs the email address. My example
# outputs them to a text file called emailaddress.txt
#
# I wrote it to get all the email addresses out of my cpanel box.
# You are free to use this program for your own purposes. If you
# improve it, please let me know. If it is horribly flawed, please let me know.
#
# Author: Hans C. Kaspersetz
# Date: 10/27/2007
# Email: hans [at] cyberxdesigns [dot] com
#
# Usage on cpaneli cli> ls -d /home/*/mail/*/*/ | getAllEmail.awk > emailaddress.txt

BEGIN {
}
{
tcmd = "test -d " $1
if(!system(tcmd)){
split($1,MyArray,"/")
print MyArray[6] "@" MyArray[5]
}
}
 
 2. After that run below cmd with root privileges:

#ls -d /home/*/mail/*/*/ | awk -f getAllEmail.awk > emailaddress.txt
Finish.

Nguyen Si Nhan - Cpanel.net

Cách đặt mac address tĩnh cho gateway chống sniff

Start -> run -> cmd:
Go Daddy $7.49 .com Sale!
c:\>arp -s <ip of gateway> <mac address of gateway (hex)>
hoặc
netsh -c "interface ipv4" set neighbors "wireless network connection" "ip of gateway" "mac address of gateway"


Xóa mac address tĩnh: (delete a static mac address )
arp -d ip

Nguyen Si Nhan

Wednesday, November 16, 2011

How To Install Perl Modules Manually and Using CPAN command


How To Install Perl Modules Manually and Using CPAN command

Perl CPAN LogoInstalling Perl modules required by various open source software is a routine tasks for sysadmins. Installing Perl modules manuallyby resolving all the dependencies is  tedious and annoying process.

Installing Perl modules using CPAN is a better solution, as it resolves all the dependencies automatically. In this article, let us review how to install Perl modules on Linux using both manual and CPAN method.


When a Perl module is not installed, application will display the following error message. In this example, XML::Parser Perl module is missing.
Can't locate XML/parser.pm in @INC (@INC contains:
/usr/lib/perl5/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/site_perl/5.10.0 .)

Install Perl Modules Manually

Download Perl module

Go to CPAN Search website and search for the module that you wish to download. In this example, let us search, download and install XML::Parser Perl module. I have downloaded the XML-Parser-2.36.tar.gz to /home/download
# cd /home/download
# gzip -d XML-Parser-2.36.tar.gz
# tar xvf XML-Parser-2.36.tar
# cd XML-Parser-2.36

Build the perl module

# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for XML::Parser::Expat
Writing Makefile for XML::Parser
# make
# make test

Install the perl module

# make install
This is very simple for one module with no dependencies. Typically, Perl modules will be dependent on several other modules. Chasing all these dependencies one-by-one can be very painful and annoying task. I recommend the CPAN method of installation as shown below. Use the manual method only if the server is not connected to the Internet.

Install Perl Modules using CPAN automatically

Verify whether CPAN is already installed

To install Perl modules using CPAN, make sure the cpan command is working. You should have the CPAN perl module installed before you can install any other Perl modules using CPAN. In this example, CPAN module is not installed.
# cpan
-bash: cpan: command not found

# perl -MCPAN -e shell
Can't locate CPAN.pm in @INC (@INC contains:
/usr/lib/perl5/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/5.10.0
/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0
/usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl/5.10.0 .).
BEGIN failed--compilation aborted.

Install the CPAN module using yum

# yum install perl-CPAN
Output of yum install perl-CPAN command:
Loaded plugins: refresh-packagekit
updates-newkey                       | 2.3 kB     00:00
primary.sqlite.bz2                   | 2.4 MB     00:00
Setting up Install Process
Parsing package install arguments

Resolving Dependencies
Transaction Summary
=============================================================================
Install      5 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 1.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): perl-ExtUtils-ParseXS-2.18-31.fc9.i386.rpm     |  30 kB     00:00
(2/5): perl-Test-Harness-2.64-31.fc9.i386.rpm         |  70 kB     00:00
(3/5): perl-CPAN-1.9205-31.fc9.i386.rpm               | 217 kB     00:00
(4/5): perl-ExtUtils-MakeMaker-6.36-31.fc9.i386.rpm   | 284 kB     00:00
(5/5): perl-devel-5.10.0-31.fc9.i386.rpm              | 408 kB     00:00

Installing     : perl-ExtUtils-ParseXS                             [1/5]
Installing     : perl-devel                                        [2/5]
Installing     : perl-Test-Harness                                 [3/5]
Installing     : perl-ExtUtils-MakeMaker                           [4/5]
Installing     : perl-CPAN                                         [5/5]


Installed: perl-CPAN.i386 0:1.9205-31.fc9
Dependency Installed:
  perl-ExtUtils-MakeMaker.i386 0:6.36-31.fc9
  perl-ExtUtils-ParseXS.i386 1:2.18-31.fc9
  perl-Test-Harness.i386 0:2.64-31.fc9
  perl-devel.i386 4:5.10.0-31.fc9
Complete!

Configure cpan the first time

The first time when you execute cpan, you should set some configuration parameters as shown below. I have shown only the important configuration parameters below. Accept all the default values by pressing enter.
Note: Make sure to execute “o conf commit” in the cpan prompt after the configuration to save the settings.
# cpan

Sorry, we have to rerun the configuration dialog for CPAN.pm due
to some missing parameters...

CPAN build and cache directory? [/root/.cpan]
Download target directory? [/root/.cpan/sources]
Directory where the build process takes place? [/root/.cpan/build]

Always commit changes to config variables to disk? [no]
Cache size for build directory (in MB)? [100]
Let the index expire after how many days? [1]

Perform cache scanning (atstart or never)? [atstart]
Cache metadata (yes/no)? [yes]
Policy on building prerequisites (follow, ask or ignore)? [ask]

Parameters for the 'perl Makefile.PL' command? []
Parameters for the 'perl Build.PL' command? []

Your ftp_proxy? []
Your http_proxy? []
Your no_proxy? []
Is it OK to try to connect to the Internet? [yes]

First, pick a nearby continent and country by typing in the number(s)
(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 5

(1) Bahamas
(2) Canada
(3) Mexico
(4) United States
Select your country (or several nearby countries) [] 4

(2) ftp://carroll.cac.psu.edu/pub/CPAN/
(3) ftp://cpan-du.viaverio.com/pub/CPAN/
(4) ftp://cpan-sj.viaverio.com/pub/CPAN/
(5) ftp://cpan.calvin.edu/pub/CPAN
(6) ftp://cpan.cs.utah.edu/pub/CPAN/
e.g. '1 4 5' or '7 1-4 8' [] 2-16

cpan[1]> o conf commit
commit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm'

cpan[2]> quit
No history written (no histfile specified).
Lockfile removed.

Install Perl Modules using CPAN

You can use one of the following method to install a Perl module using cpan.
# /usr/bin/perl -MCPAN -e 'install Email::Reply'

(or)

# cpan
cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]> install "Email::Reply";
Output of above perl install command:
CPAN: Storable loaded ok (v2.18)
Going to read /root/.cpan/Metadata
Database was generated on Mon, 15 Sep 2008 11:02:52 GMT

Running install for module 'Email::Reply'
Running make for R/RJ/RJBS/Email-Reply-1.202.tar.gz
CPAN: LWP::UserAgent loaded ok (v2.036)
CPAN: Time::HiRes loaded ok (v1.9711)
Fetching with LWP:
ftp://carroll.cac.psu.edu/pub/CPAN/authors/id/R/RJ/RJBS/Email-Reply-1.202.tar.gz

CPAN: checksum security checks disabled because Digest::SHA not installed.
Please consider installing the Digest::SHA module.

CPAN: Compress::Zlib loaded ok (v2.008)
Email-Reply-1.202/
Email-Reply-1.202/Changes
CPAN: File::Temp loaded ok (v0.18)
Warning: prerequisite Email::Abstract 2.01 not found.
Warning: prerequisite Email::MIME::Creator 1.41 not found.
Writing Makefile for Email::Reply
---- Unsatisfied dependencies detected during ----
----       RJBS/Email-Reply-1.202.tar.gz      ----
Email::Abstract [requires]
Email::MIME::Creator [requires]
Shall I follow them and prepend them to the queue

of modules we are processing right now? [yes]
[Note: CPAN automatically detects that Email::Abstract
       and Email::MIME::Creator is required]

Fetching with LWP:
ftp://server/pub/CPAN/authors/id/R/RJ/RJBS/Email-Abstract-2.134.tar.gz
make -- OK
make install  -- OK

Fetching with LWP:
ftp://server/pub/CPAN/authors/id/R/RJ/RJBS/Email-MIME-Creator-1.454.tar.gz
make -- OK
make install  -- OK

Warning: prerequisite Email::Simple::Creator 1.4 not found.
Writing Makefile for Email::MIME::Creator
Email::Simple::Creator [requires]
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]
[Note: CPAN automatically detects that Simple::Creator is required]

Fetching with LWP:
ftp://carroll.cac.psu.edu/pub/CPAN/authors/id/R/RJ/RJBS/Simple-Creator.tar.gz
make -- OK
make install  -- OK

Fetching with LWP:
CPAN.pm: Going to build R/RJ/RJBS/Email-Reply-1.202.tar.gz

make -- OK
make install  -- OK
In the example above, Email::Reply is dependent on the several other modules. CPAN automatically resolves the dependencies and installs Email::Reply and all the dependent Perl modules.
Source: thegeekstuff.

Require SMTP Authentication CpanelX - WHM


Require SMTP Authentication

For WHM version 11.30
By default, WHM uses POP before SMTP authentication. This means that when a user on a POP mail server authenticates a session, he will be allowed to send messages for 30 minutes without re-authenticating through SMTP.
While this method is secure, some administrators prefer to use SMTP authentication at all times. To require SMTP authentication, issue the following command as root in a terminal session:
/usr/local/cpanel/bin/tailwatchd --disable=Cpanel::TailWatch::Antirelayd
note Note: The same applies for IMAP servers. If you're running an IMAP mail server and you wish to require SMTP authentication when messages are sent, you will need to run the command listed above.

Cpanel.net

Tuesday, November 15, 2011

How to copy packages between WHM -CPANELX

- All package of CpanelX is on dir /var/cpanel/packages/ ,you just copy these packages to another server to same dir is ok, that's all.


Nguyễn Sĩ Nhàn

Monday, November 14, 2011

How to fix Strict Standards: Non-static method JLoader::import() should not be called statically in

Edit file php.ini such as:


error_reporting = E_ALL & ~E_NOTICE 


And then restart your apache ,it'll be ok.


Nguyen Si Nhan


Create user mysql by cmd

1. CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
2. GRANT ALL PRIVILEGES ON databasename.* TO 'monty'@'localhost;
3.FLUSH PRIVILEGES;

 > create database marketpro CHARACTER SET utf8 COLLATE utf8_general_ci;

Nguyen Si Nhan