Archive for the ‘Ensim’ Category

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]

How to increase SquirrelMail maximum attachment size from 2MB.

Friday, April 27th, 2007

SquirrelMail is written in PHP, the max attachment size for webmail is inherited from the “upload_max_filesize” value set forth in php.ini

Here you go..

1, Locate your php.ini.
2, Open it in a text editor
3, Search for upload_max_filesize.
4, Change 2M to something else, for example 5M.
5, If the upload_max_filesize is larger than post_max_size, you must increase post_max_size so that it’s bigger than upload_max_size
6, If the value of post_max_size is larger than memory_limit, you must increase memory_limit so that it’s larger than post_max_size.
7, Save your changes to the file.
8, Restart your web server.

Note 1:
There’s no documented max upload size.

Note 2:
If uploading the file is slow, you may have to increase the max_execution_time so that the script does not terminate before the entire file is uploaded.

Thank you :)

What is Pear ?

Monday, April 23rd, 2007

PEAR Is short for ‘PHP Extension and Application Repository’

PEAR is having it’s primary goal to become a repository for PHP extensions and library code. The most important goal of the PEAR project is to try to define standard coding packages that can be used be developers directoly and it is re-usable coding.
Each package is a seperate project and is having a diffreent developer team.

Packages are in the gzipped tar files with a description file inside, and installed on your server using the PEAR installer.

You can install any pear package as
———–
pear install pear-package-name
———–

You can check all the PEAR packages that are available with
————
pear list-all
————

You can check installed PEAR packages on your server as
————
pear list
————

semget: No space left on device

Sunday, April 22nd, 2007

This relates to semaphores on your system (you’ve run out). Run the following to clear them out:

ipcs | grep apache | awk ‘{print $2}’ > sem.txt
for i in `cat sem.txt`; do { ipcrm -s $i; }; done;

cgi files generate Internal Server Error

Sunday, April 22nd, 2007

This means that the cgi script did not execute properly. There are several causes that can generate this error so a few things would need to be checked.

1) check the /var/log/httpd/suexec_log. It contains any errors that would be as a result of not having correct permissions on the file. The file needs to be in a cgi-bin and must have the owner/group as the username who owns the site. If it’s owned by anyone else, it will not run. Also, the script must have execute permission. The most common chmod permission is 755. Go through all directories from the public_html down to the directory the script is in, and make sure they’re all set to 755 (public_html can be 750 *only* if it has a group of apache).

If the suexec_log only shows the script being run, then the cause may be with the script code itself. The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt.

cd /home/username/domains/domain.com/public_html/cgi-bin
./script.cgi
One common error is to use an incorrect interpreter. The 2 most common interpreters are:

#!/usr/bin/perl
and

#!/usr/local/bin/php
This code must appear on the first line of the script. Somtimes a file is uploaded in windows format so the trailing newline (return) character is formed incorrectly and the file would need to be reuploaded in a different format.

Other errors that would be generated when running the script manually from ssh would be missing perl modules, in which case you’ll need to install them yourself. Cpan is the easiest method to install new perl modules, eg:

perl -e shell -MCPAN
install Bundle::DBD::mysql

Increase the max upload filesize in apache/php

Sunday, April 22nd, 2007

edit: php.ini file on server

You can locate php.ini file using — php -i | grep php.ini

/usr/local/lib/php.ini

Search for

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
Change the 2M to whatever new value you want, then restart apache.

Running CGI script from any directory or via /~username/cgi-bin

Sunday, April 22nd, 2007

In order to force apache to allow cgi script to run, simply create a file called .htaccess inside the directory in which you wish to run the scripts. Inser this text into the file:

Options +ExecCGI
AddHandler cgi-script .cgi .pl

Installing Ioncube Loaders on your server..

Saturday, April 21st, 2007

You WILL require root access to the server in order to do this.

1. Download the latest loaders to your computer from http://www.ioncube.com/loaders.php and upload them to your webspace
2. Move the ioncube folder to a permanent location by entering:
mv ioncube /usr/local
3. Next, you need to locate the php.ini file, to do this enter:
locate php.ini
4. You should find it is in /usr/local/lib/php.ini. Now that you know the location of php.ini you need to edit it.
pico /usr/local/lib/php.ini
5. Now find where other zend extentions are in the file.
ctrl + w: zend_extension
6. Paste in your new line for ioncube loader
zend_extension = /usr/local/ioncube/ioncube_loader_lin_x.so (Replace x with your version of PHP eg. 4.4)
7. Save the changes
ctrl + X then Y and enter
8. Restart the web server to take effect.
/etc/init.d/httpd restart

That’s it! Ioncube is now installed on your server! You should now see a section in your PHP Info page that says:

Additional Modules
Module Name ionCube Loader

How can I enable Register Globals?

Saturday, April 21st, 2007

There are 3 methods —

1st : Enable on complete Server.

Code :

php -i | grep php.ini

This will give you exact path of php.ini file

Edit php.ini file — set

register_globals on

2nd : Enable on particular domain or folder using .htaccess

If you don’t want to turn Register Globals on for your whole server or don’t have access to as you are a reseller then you can enable them just on the particular folder and all subfolders below it. To do this, simply put the following line into a text file and save it as “.htaccess”. Then upload it to that folder.

php_value register_globals on

3rd : If .htacess fails

Sometimes, the .htaccess method will not work on your server and you’ll get an Internal Server Error message after trying that. In the event of this, you can try using a php.ini file. To do this, create a file named “php.ini” and insert the following line:

register_globals=On

Then upload the php.ini file to the folder for which you wish to enable register globals.

How do I view Messages in the Qmail Queue?

Friday, April 20th, 2007

Type the following command at prompt -

/var/qmail/bin/qmail-qstat

To read multiple messages in queue -

/var/qmail/bin/qmail-qread