Thursday, November 13, 2014

MySQL database not showing in cPanel

MySQL database not showing in cPanel

If database is not showing in cpanel, make sure database exists in the
server. If it exists, make sure permission/ownership of database is
correct.

Then check whether database details are listed in
/var/cpanel/databases/username.yaml

If it is not listed in it, run following command to fix it.

/usr/local/cpanel/bin/setupdbmap

Check cpanel and database should be listed in it.

If database size is zero while listing, run the following command to fix it.

/scripts/update_db_cache

If it’s not works

/scripts/upcp –force

/scripts/checkperlmodules –force

/usr/local/cpanel/bin/setupdbmap

Sender verify defer for : require_files: error for /usr/local/cpanel/3rdparty/mailman/mail/mailman: Permission denied

==================
2014-10-26 16:11:29 H=localhost.localdomain (mx108.suhailah.com) [127.0.0.1]:56296 sender verify defer for <test@suhailah.com>: require_files: error for /usr/local/cpanel/3rdparty/mailman/mail/mailman: Permission denied
===================

Run following script to fix this issue. 
======
 /usr/local/cpanel/3rdparty/mailman/bin/check_perms -f
========

Wednesday, November 12, 2014

Webmail mail login error : IMAP Error: Login failed for info@suhailah.com from 122.22.122.38.52. AUTHENTICATE PLAIN: Authentication failed. in /usr/local/cpanel/base/3rdparty/roundcube/program/lib/Roundcube/rcube_imap.php on line 184 (GET /cpsess545521111/3rdparty/roundcube/index.php)


========
Log to be checked if using roundcube

tail -fn0 /var/cpanel/roundcube/log/errors

=========
 IMAP Error: Login failed for info@suhailah.com from 122.22.122.38.52. AUTHENTICATE PLAIN: Authentication failed. in /usr/local/cpanel/base/3rdparty/roundcube/program/lib/Roundcube/rcube_imap.php on line 184 (GET /cpsess545521111/3rdparty/roundcube/index.php)
=========

Please go to WHM > Change Hostname area and change your hostname to server.domain.tld instead of domain.tld. After you've changed the hostname to be a subdomain off the main domain rather than the main domain itself,  After doing that, move these files:


cd /etc
mv userdomains userdomains.bak
mv domainusers domainusers.bak
mv trueuserdomains trueuserdomains.bak

After moving those files, then run this command:


/scripts/updateuserdomains


You will get messages about the files you’ve moved no longer existing. Those files will be recreated by the command.

Advanced linux commands for quick system analysis



There are many linux commands which help you in many ways

===============
#ifconfig :-
=========

this command is used to setup network details . Also we can see ip address of the system . there are many uses of this command . complete usage of this command can be seen use command  "man ifconfig " .

some uses of that commands are :-
ifconfig -a   --> will show all details of networks

ifconfig eth0 --> will show details of fist ethernet network

 ifconfig eth0 down --> will take first ethernet down  or shutdown ethernet first

 ifconfig eth0  up -->  just opposite to the down command . it will start firsth ethernet

ifconfig eth0 172.18.100.4  netmask 255.255.255.255 -->  will set system ip to 172.18.100.4 and

 netmast to 255.255.255.255

#netstat :-
========
 netstat is very important command to use on servers . it shows details about all port activities . which port are working and how many connections on the ports at any time . complete usage of this command can be seen using command "man netstat" .
Some uses of this commands are :-

netstat -a --> will show all port activities
netstat -at --> will show all TCP port activities
netstat -au --> will show all UDP port activities
netstat -l --> ports which are listening
netstat -tl --> TCP ports which are listening
netstat -s --> statistics for all ports
netstat -st --> statistics for alls TCP ports only
netstat -n --> will show hosts in numeric form i.e. in ip address forms
netstat -c --> continuously

use many commands combinations to get your desired results . like :-
netstat -atn | grep ":8080 "  --> it will show connections on only 8080 port

also
# netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
5 CLOSE_WAIT
      2 CLOSING
     31 ESTABLISHED
     11 FIN_WAIT1
     49 FIN_WAIT2
      8 LAST_ACK
      2 LISTEN
     27 SYN_RECV
    608 TIME_WAIT

#nslookup :-
========
this command is used to see dns entries of any domain or ip . like
nslookup pkonline.in --> it wil show details about pkonline.in , its ip and max available info
nslookup 1.1.1.1 --> will show details about this ip address
nslookup pkonline.in 2.2.2.2 --> will show details of pkonline.in from dns 2.2.2.2

 traceroute :-

this command is used to trace route between your system to destination . use :-
traceroute google.com --> will show all nodes of connectivity between your system and google.com servers .


#iostat :-
=========

this command is used to get all input and output statistics over all hard disks. to install this command in system use  "yum install sysstat " .uses :-
iostat --> will show average of input and output operation on every disk partition .
iostat 2 --> will show continuously current io statistics .


#mpstat:-
=======

mpstat shows output stats of every processor available .

mpstat , mpstat -P all --> will how all processors statistics .

mpstat -P 0 --> will show just first processor output statistics .


#uptime :-
======
it will show uptime of your server . that means from how much time your server is running . This will reset after restart of server . to use it just write uptime in shell and hit enter

server# uptime
 23:54:25 up 11 days, 19:19,  2 users,  load average: 14.73, 10.45, 9.63

wall :-
========
this command is used to send a message to all shells of that system . Suppose many people are logged in on that server . If any one want to convey any message to all people then use wall .like :-
wall "dont delete anyfile from directory /home/suhail" --> the message will appear to every one logged in the server

#w,who,whoami ,who am i :-
==========
these three commands will provide you details about how many user are logged in the system and from how much time .
w --> will show details of all logged in users .
who -- > similar to w but show less details .
whoami --> will show you your username .
who am i --> will show you more details about your login .

#top :-
=========
top is most basic and mostly used command . it can provide complete overview of your system . This will show CPU usage , RAM usage , load on system ,which process is using maximum system .etc .

#htop :-
=====
slightly modified version of top command . It show use individually of every CPU .

#rsync :-

this command is used to make two directoris in sync with each other . This can be used over two different systems or on the same system itself .

rsynch -uar /home/suhail/   /home/backup/ --> this will send all updated file from /home/suhail/ directory to /home/backup directory .
rsync --rsh='ssh -p22' -aur root@192.168.0.1:/home/suhail/images/    /home/suhail/images/ --> this command will get all files from different machine to current machine .

with ssh key
server # rsync -avzrp -e "ssh -i /root/.ssh/id.suhail" /home/suhail/public_html/* root@122.12.122.12:/home/suhail/public_html/

#lsof :-
=======
it will provide list of open files . there are many uses of this command . like :-
lsof --> list all opened files on the system
lsof /home/suhail/suhail.log --> will show open statistics for specific file  /home/suhail/suhail.log
lsof +D  /home/suhail/  --> will show files open under directory /home/suhail/
lsof -u root --> will show files opened by user root .
lsof -p 5 --> will specify opened file by specific process .i.e process id 5.

#find :-
=======
this command is used to search any file in the system .this can be used like that :-
find /home/ -name abc.txt --> this command will try to search file abc.txt under directory /home/ .
find / -name abc.txt --> this command will find abc.txt in the whole system .
find . -name abc.txt --> this command will find abc.txt in the current directory .

#whereis :-
=========
this command will search the location of commands . like:-
whereis cp --> will show the location of cp command . This may also search is binary files .

#alias :-
======
this command is used to create aliasing for any command. this command is helping to create shortcuts of commands .like :-
alias pp="ls -lhtr" --> after this if you run pp command this it will show results equivalent to ls -lhtr

#unalias:-
=======
this command will remove the alias created .like:-
unalias pp --> now pp will no longer be any alias .

#df :-
======
this command is used to show storage usage of all hard disk partitions . like :-
df -k --> this will show all partitions witgh there usage and free memory available in bits.
df -kh --> this will show size in MB KB and GB format .

#du :-
=======
this command is used to show disk usage by directories and files . this can be used in maby ways .
du --> will show directories which are using some space that means files which are non empty .
du -a --> this comamnd will show all files . also will show empty files
du -ah --> will show memory in human readle form like KB MB GB .
du -s --> will show summarised memory .
du -sh * --> will show memory taken by all files and directory at your current location with human readable form .

#diff:-
=======
this command is used to find difference between two files . for comparison of two files this is well structured command .
diff file1 file2 --> will print differences between this two files  .

“SSH: JAILSHELL: FORK: RETRY: RESOURCE TEMPORARILY UNAVAILABLE”

Today, one of the customer SSH(cPanel) getting error as below when they logged into their jailed shell access.
======================
-jailshell: fork: retry: Resource temporarily unavailable
-jailshell: fork: retry: Resource temporarily unavailable
-jailshell: fork: retry: Resource temporarily unavailable
========================

To overcome the problem, simply run the following command from root.
=================
for i in `ps aux | grep username | awk '{print $2}'`; do kill -9 $i; done

for i in `cat /proc/mounts | grep username | awk '{print $2}'`; do umount $i; done
================


Sunday, October 26, 2014

wordpress installation using the Softaculous script installer

To Install Wordpress using the Softaculous script installer: 
 
1. Log in to your cPanel control panel. 
 
2. Select 'Softaculous' from the 'Software / Services' section. 
 
3. Find the section in Softaculous called 'Portals/CMS' and select 'Wordpress'. A Wordpress information page will load on the right portion of the screen. 
 
4. An install option can be found in the top right hand of the Wordpress information page. 
 
5. How to fill out the installation form: 
 
SOFTWARE SETUP 
 
A. Choose Protocol - This option allows you to choose the protocol that shows on the address bar of individual's browsers. 
 
B. Choose Domain - This drop down menu includes all domain names and sub-domain names that are on the account. Choose from this drop down menu the domain name where you wish to install Wordpress 
 
C. In Directory - This is the option to choose the directory where Wordpress will be installed. For example, to have Wordpress installed in a folder called 'dir', type dir in the text box. To have Wordpress installed only on the domain, leave the field blank. 
 
D. Database Name - This option allows you to choose the name of the Wordpress database. Default content will be included in this, you may leave it as this content or rename it. 
 
Password : Type in a password you will use to access your Wordpress Administrator Dashboard. This password is very important to remember. If you lose this password, you will have to reinstall Wordpress. 
 
SITE SETTINGS 
 
A. Site Name - This option allows you to type in the name of your site. 
 
B. Site Description - This option is used to input a short description of your website. 
 
DATABASE SETTINGS 
 
A. Table Prefix - This option allows you to change the prefix of your table. This settings is for more advanced users and it is advisable to leave it as-is. 
 
B. Import Sample Data - This option allows you to select whether or not Wordpress will be installed with sample data given by Wordpress. 
 
ADMIN ACCOUNT 
 
A. Admin Username - This is where the Wordpress administrative username is selected. Wordpress is managed through a separate control panel, this information will be used to access that control panel. 
 
B. Admin Password - This is where the Wordpress password is selected. It is used in conjunction with the username above to access the Wordpress control panel. 
 
C. Real Name - Input your real name here. 
 
D. Admin E-mail - This address will be used should the Wordpress login information be lost. 
 
E-mail installation details to (optional): Fill this box with the e-mail address where you would like detailed information regarding the installation sent. 
 
After filling out all fields hit the "Install" button and Softaculous will automatically install Wordpress with the specifications provided.

WordPress is giving error: "Missing a temporary folder" while uploading image/media ?

WordPress is giving error on image upload : "image.jpg" has failed to upload due to an error "Missing a temporary folder."

If you are receiving this error please follow these simple  instructions below:

1. Create a "tmp" folder in your WordPress root directory with 777 permissions. This can be done by your FTP program.

2. Also create a "php.ini" file in same location.

3. Add the following in php.ini file:

upload_max_filesize = 16M
upload_tmp_dir = on
upload_tmp_dir = /home/username/public_html/wordpressDir/tmp

Please make sure to replace username with your hosting username, and wordpressDir with the directory name of your WordPress install. 
If you have installed WordPress on your homepage then the path will be like: upload_tmp_dir = /home/username/public_html/tmp
4. Copy the same php.ini file to your wp_admin folder.

That's it.



WordPress dashboard loading blank page with PHP Fatal error: Access to undeclared static property: WP_Screen::$this in /home/suhail/public_html/wp-admin/includes/screen.php on line 706

The WordPress admin dashboard loading blank page for WordPress version 3.3.1. That is, when a WordPress user logs in, WordPress admin dashboard displaying blank page. Menu with links are present but none of the link works. For this reason, users can’t edit or add new posts etc.

 Here is the solution. Just go through your error logs and see the logs that you get. I have recently came across a similar situation and here’s the logs that I got.

[06-Jul-2014 05:55:27 UTC] PHP Fatal error:  Access to undeclared static property: WP_Screen::$this in /home/suhail/public_html/wp-admin/includes/screen.php on line 706
[06-Jul-2014 05:55:33 UTC] PHP Fatal error:  Access to undeclared static property: WP_Screen::$this in /home/suhail/public_html/wp-admin/includes/screen.php on line 706

To fix this bug:

1. Open the file wp-admin/includes/screen.php
2. Locate the line number 706
3. You will find the 706th line as

<?php echo self::$this->_help_sidebar; ?>
Replace the above mentioned line as

<?php echo $this->_help_sidebar; ?>
4. Save the changes. This should fix the problem.

That’s it!!!  :)

501 Too many syntax or protocol errors

Solution:
When sending emails using outlook you might receive the error above. It seems that when you copy & paste the email addresses into the To field, they include quotations around them that the server did not know how to handle (i.e. ‘suhail@website.com’ instead of just suhail@website.com).
Remove the quotations & then try sending emails.

Monday, October 20, 2014

Blank page after login to phpMyAdmin

1) I login to cPanel and reset password (to the same one)
2) I logout and login again
3) I click phpMyAdmin and I get into phpMyAdmin (no more login form or blank page)