There are instances when additional IPs are assigned to a certain server but they still do not ping or respond, and only the main IP of the server pings. For Cpanel based servers you will find them assigned at below link as well :

WHM >> IP Functions >> Show IP Address Usage

You can verify the IPs on shell using below command to see if they are attached to the virtual network interfaces are not :

ifconfig -a

Now if you find that additional IPs are not appearing , then you can make them available using below command :


service ipaliases start

For Cpanel based servers such additional IPs are listed at /etc/ips.

Tags: , , ,

Riz Khan on April 27th, 2010

Many times swap is not setup according to the requirement during the server setup/OS install, and once the server has been inducted in production its not possible to reinstall the OS. Or simply the swap size requirement can increase over time on a server. In such scenario we can add swap on the server using a swapfile.

Below are the exact steps you can follow to add swap to the server using swap file:

# dd if=/dev/zero of=/required/path/swapfile bs=1024 count=10000000
(10GB)

- makeing the swap file
# mkswap /required/path/swapfile

- turning the swap on
# swapon /required/path/swapfile

- verifying that swap is added
# free -m

And you are done, you can adjust the size of the of the swap using the ‘count’ parameter in dd command.

Some points to note for this :

  • You will need to make sure that you have enough space on related partition to do this
  • Its recommended to stop main services like apache/mysql on the server before doing this to avoid any data corruption.
  • If there is one server partition based swap already then it should be switched off, it can be done following below steps :

swapoff /dev/sdaX
-where sdaX represent the partition being used for swap.

-e.g. with following partition on the server :
root@linuxtech [~]# fdisk -l /dev/sda

Disk /dev/sda: 499.9 GB, 499989348352 bytes
255 heads, 63 sectors/track, 60786 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3200 25599577+ 83 Linux
/dev/sda3 3201 4475 10241437+ 83 Linux
/dev/sda4 4476 60786 452318107+ 5 Extended
/dev/sda5 4476 5750 10241406 83 Linux
/dev/sda6 5751 6260 4096543+ 82 Linux swap / Solaris
/dev/sda7 6261 6515 2048256 83 Linux
/dev/sda8 6516 60786 435931776 83 Linux
root@linuxtech [~]#

-for above we can switch off swap using following command :

swapoff /dev/sda6

Tags: , ,

Riz Khan on April 27th, 2010

Perl is normally installed without thread support, but you may need to install threaded perl on your server to fulfill requirement for any application or for perl based software development.
This require additional -Dusethreads parameter used during the configuration step of installation. Below are the exact steps that you can follow to install threaded perl on your server :


wget http://www.cpan.org/src/perl-5.8.8.tar.gz
tar -xzvf stable.tar.gz
cd perl-5.8.8
./Configure -Dprefix=/usr -Dusethreads
make
make test
make install

and you are done !

Tags: , ,

Riz Khan on April 24th, 2010

Cpanel now support the optional apache module mod_spelling using which you can have the optoin for your URLs to load even if they have one spelling mistake or there is one capitalization error, which would give non found 404 otherwise as Linux is cases senstive operating system.

e.g. If you have below URL :

http://yourdomain.com/yourpage.html

Then after installing mod_spelling and enabling it for this domain the below URLs will also open above page :

http://yourdomain.com/Yourpage.html
http://yourdomain.com/yourPage.html
http://yourdomain.com/ourpage.html
etc

And if with one correction the module see more than one options matching the criteria then it will give you option to load any of the available pages.

Below is how you can achieve this.

First run belwow on Cpanel based server :


/scripts/easyapache

And select ‘Spelling’ from the available module list for apache.

Once apache/php are recompiled with this option and easyapache finishes, you can put below code in the .htaccess to apply it to any directory/directories :


< IfModule mod_speling.c >
CheckSpelling On
< / IfModule >

Enjoy !

Tags: , , ,

When sending emails from scripts, not setting proper from address can give two problems, once is email ending up in spam/junk box of recieving email server and second is that the return path would be user@server.hostname.com.

To avoid this and to setup return path using php mail() function you need to use the fifth parameter of php mail() function :

Reference : http://php.net/mail

bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

You can see above that the parameter 4 and 5 are optional. Exim supports the 5th parameter and you should be able to setup the return path using format like below like this:

mail($email, $subject, $msg, $mailheaders, "-f$from_email");

Tags: , , , ,

Riz Khan on April 24th, 2010

If you happen to mess up your ssh configuration some how and lock yourself out of ssh then you can reset the ssh config from Cpanel using below method :

  • Login to WHM on non secure port i.e 2086
  • And then use below URL to reset the config :

http://YOUR.SERVER.IP:2086/scripts2/doautofixer?autofix=safesshrestart

If it do not help in your case then ofcourse you either need to contact your hosting/data center or can use KVM if you have it installed for your server.

Tags: , , ,