Pages

Wednesday, 30 October 2013

Allow access from an IP address

If you want to give access to your domain only for a single IP address. In such case, create an htaccess file(.htaccess) and add the content given below.


Order Deny,Allow
Deny from all
Allow from <ip address>


Note: replace the <ip address> with the original IP address.



Tuesday, 29 October 2013

Retrieve Plesk password in windows server

There are two ways by which we can retrieve the Plesk password.


Method 1:
=========
1. Login to server via RDP and take command prompt
2. Execute the following command from the command prompt.

=====
"%plesk_bin%\plesksrvclient" -get
=====

Method 2:
========

1. Login to server via RDP and take command prompt
2. Type %Plesk_bin% to go to Plesk binary.
3. Now type plesksrvclient.exe -get


eg: C:\Program Files\Parallels\Plesk\admin\bin>plesksrvclient.exe -get

Monday, 28 October 2013

Webalizer statistics not getting updated

Issue
=====
Sometimes,  webalizer will  not get updated automatically. Then, we need to update the webalizer manually by using following command.

/usr/local/cpanel/3rdparty/bin/english/webalizer -N 10 -D /home/username/tmp/webalizer/dns_cache.db -R 250 -p -n domain.com -o /home/username/tmp/webalizer /usr/local/apache/domlogs/domain.com

Note: Replace domain.com with original domain name.

Joomla Error: jtablesession::Store Failed DB function failed with error number 145

Error:
=====
Joomla Error – jtablesession::Store Failed DB function failed with error number 145

You can fix this issue by following the steps given below.

1) Login into phpmyadmin.
2) Select the database.
3) Select the table jos_session.
4) Select the option repair.


You can also fix this using MySQL query.

1) mysql> use databasename;  (Replace databasename with original name)

2) mysql> repair table jos_session;

Joomla error: Fatal error: Call to undefined function jimport()

You may sometimes see Joomla error similar to the one given below:

Fatal error: Call to undefined function jimport() in /home/username/public_html/includes/framework.php on line 76

Solution:
========
You can resolve this issue by simply replacing the folder "libraries" from backup(if you have).

Joomla error: send mail failed: could not execute: /usr/sbin/sendmail

Error
======

send mail failed: could not execute: /usr/sbin/sendmail

You will be redirected to the homepage now



Solution
========
Login as Joomla administrator and change the mailer from 'Sendmail' to PHP mail function.

Site->Global Configuration->Mail

Change database engine

You can specify the database engine type you want to use, during table creation using the query :

-------------
CREATE TABLE table_name (a INT, b CHAR (20)) ENGINE=InnoDB;
------------

If the table already exists use the query given below.

----------------
ALTER TABLE 'table_name' Engine=InnoDB charset=utf8 collate=utf8_bin;
----------------

MySQL database not showing in cPanel.

Sometimes, MySQL databases may not show in cPanel. To solve this issue, login into server as root user and run the following command.

#/usr/local/cpanel/bin/setupdbmap

Forcefully redirect http to https

You can set rules in .htaccess file of the domain to forcefully redirect a domain to use https protocol.

Use the code given below in .htaccess file.
==========
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://<domain name>/$1 [R,L]

==========

Note: Use the domain name in place of <domain name> 

Thursday, 24 October 2013

Internal server error(Cloud linux server)

Symptoms: Internal server error while accessing the website.

The apache error log will be similar to the following:
=====
Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/abcd/public_html/index.php, referer: http://www.abcd.com/
 =====


From the logs, we can understand that the issue is due to lack of memory. So, we need to check the memory usage of the cPanel user. The following command will show the cPanel users which are affected by memory limits. 



lveinfo --by-fault=mem --display-username

Sample output is given below:


===
root@test [~]# lveinfo --by-fault=mem --display-username
ID aCPU mCPU lCPU aEP mEP lEP aVMem mVMem lVMem aPMem mPMem lPMem EPf VMemF PMemF
abcd 0 0 12 0 0 20 672.5M 1.1G 1.1G 153.6M 153.6M 1.1G 0 4 0
root@test [~]#
===



a-average
m-maximum
l-limit
VMem - virtual memory

The values will refresh every minute. If it doesn't, then it means that virtual memory is cached somewhere.

We can clear the cache temporarily using the command given below.

for i in `ipcs -m|grep <user> |awk '{print $2}'`; do ipcrm -m $i; done

Note: please replace <user> with the correct cPanel username.


Sample output is given below:

===
root@test [~]# for i in `ipcs -m |grep abcd |awk '{print $2}'`; do ipcrm -m $i; done
root@test [~]#
===