Archive for April, 2007

To access admin MySQL you should use the following in command prompt:

Monday, April 30th, 2007

cd %plesk_dir%\mysql\bin

mysql -uadmin -p<admin_pass> -P8306 psa

8306 is the admin mysql port used by plesk and psa is the plesk database

To access to clients mysql use the same string except port. Clients mysql uses standard port 3306

mysql -u<clientdatabaseusername> -p<databasepass> -P3306 <clientdbname>

How To Install Php under Windows 2003 Server

Monday, April 30th, 2007

1. Download the PHP Installer

Download your favorite php version here: http://www.php.net/downloads.php ,and choose the windows installer

2. Installing PHP

Run the installer and choose Advanced Setup

Choose the path for your PHP installation

Choose the directory for temporary files (it’s recommended to use the default path)

Insert your smtp details

Now choose what kind of errors you want php to show ( Display all errors,warnings and notices is recommended only when you’re developing your website.If you have already completed the developing steps it’s better to choose Display all errors and warnings only).

Now select your webserver (On windows 2003 IIS 6.0 it’s the default webserver).

Select now the extensions you want to be run by php

Now click next to let the installation run on your server. Once the installation is complete reboot the server first.

3. IIS Configuration

Now open IIS,select Web Service Extensions on the left frame and check that PHP extension is allowed.If not click on Add a new Web service Extension and ,for the extension name,choose PHP, And in the required file field choose the isapi.dll file that you’ll find in the php directory.

4. PHP.ini file

Sometimes the installer,due to some permission problems,could not copy the php.ini file in the Windows directory. So select the php.ini file that you’ll find in the php directory and copy it in the C:/Windows directory.

5. Testing

Create a new text file and rename it “index.php”. This file should contain one line that reads:

<?
phpinfo();
?>

Simply copy this file to your web server and open it via your web browser. You should see a page like this one in the following screenshot:

Windows Memory Test tool

Sunday, April 29th, 2007

Windows Memory test tool –

AleGr-MEMTEST-Download

Cheers..

CentOS 5 released :)

Saturday, April 28th, 2007

Cent OS 5 is released now — check out details here

http://lists.centos.org/pipermail/centos-announce/2007-April/013660.html

Here is some help upgrading to CentOS 5 —
http://wiki.centos.org/Migration/5

Cheers …

How to access PHP5 ?

Saturday, April 28th, 2007

How to access PHP5 on your server if you have both PHP4 and PHP5 installed.

You can enabled PHP5 on particular domain by adding following line in .htaccess under public_html folder –

AddType application/x-httpd-php5 .php

Thank you :)

Installing and Configure Squid Proxy Server

Friday, April 27th, 2007

Here are the simple steps to install squid –

Login as root and execute,

cd /usr/local/src
wget http://www.squid-cache.org/Versions/v2/2.5/squid-2.5.STABLE14.tar.gz
tar -zxvf squid-2.5.STABLE14.tar.gz
cd squid-2.5.STABLE14
./configure –prefix=/usr/local/squid –disable-ident-lookups
make all
make install

Add the user squid, create the cache directory and then set permissions.

useradd -d /usr/local/squid/cache/ -r -s /dev/null squid >/dev/null 2>&1
mkdir /usr/local/squid/cache
chown -R squid:squid /usr/local/squid/cache
chown -R squid:squid /usr/local/squid
chmod -R 755 /usr/local/squid/cache

Now generate the cache files

sudo -u squid /usr/local/squid/sbin/squid -z

Now lets change the cache effective user and group to squid.

perl -pi -e ’s/# cache_effective_user nobody/cache_effective_user squid\ncache_effective_group squid/g’ /usr/local/squid/etc/squid.conf

/usr/local/squid/sbin/squid

You are done installing …

Configuration

Open the squid configuration,

pico /usr/local/squid/etc/squid.conf

specific your http_port, by default this is 3128, we will use 8080.

Find

# http_port 3128

and replace it with

http_port 8080

Now lets configure who can access your proxy, remember to only allow access to YOUR ip.

Find

http_access deny CONNECT !SSL_ports

Add below

acl myip 127.0.0.1
acl all src 0.0.0.0/0.0.0.0
acl connectmethod method CONNECT
http_access deny connectmethod
http_access deny all
http_access allow myip

Remember to replace 127.0.0.1 with the ip you want to allow access.

Find

# By default, all headers are allowed (no anonymizing is
# performed).
#
#Default:
# none

Add below

header_access From deny all
header_access Referer deny all
header_access Server deny all
header_access User-Agent deny all
header_access WWW-Authenticate deny all
header_access Link deny all
header_access via deny all

Find

# forwarded_for on

Replace with

forwarded_for off

Save and exit squid.conf, then restart squid.

kill -9 $(ps aux | grep squid | awk ‘{print $2}’)
/usr/local/squid/sbin/squid

You have now configured an anoymous proxy with squid.

Thanks to HOstgeekz :)

Useful MYSQL tips ..

Friday, April 27th, 2007

Check this —

http://souptonuts.sourceforge.net/readme_mysql.htm

Command to know the performance of your HardDisk.

Friday, April 27th, 2007

Here you go –

hdparm -Tt /dev/sda

Note: The command “hdparm” isn’t always compatible with hardware raid (3ware SATA or Dell SCSI PERC 320/DC adapters)

Simple commad to fetch RAM Information on your server.

Friday, April 27th, 2007

Linux

free -m

free -k

cat /proc/meminfo

Windows

windows control panel -> system -> right in the general tab on the bottom.

Thank you :)

Banning / Unbanning / Listing ips.

Friday, April 27th, 2007

Banning an IP
iptables -I INPUT -s [ipaddress] -j DROP

Unbanning and IP
iptables -I INPUT -s [ipaddress] -j ACCEPT

Listing the last five ip’s with the most connections
netstat -atnp -A inet | grep “:80″ | awk -F ” ” ‘{print $5} ‘ | awk -F “:” ‘{print $1}’ | sort | uniq -c | sort -nr | head -5

Listing total connections
netstat -nap | grep ESTABLISHED | wc -l
netstat -nap | grep SYN | wc -l
netstat -nap | grep TIME_WAIT | wc -l

———-

If Apf firewall is installed on server then –

Accept IP –
apf -a [ip address]

Decline IP –

apf -d [ip address]

———–
IF shorewall is installed

Decline Ip –

shorewall drop [ip address]