How to remove WHM/CPanel untrusted certificate error

Untrusted certificate
If you just bought your new server powered with cPanel/WHM and you went to login at WHM/cPanel using secure connection (https://) and got that red error saying that certificate can not be trusted.
WHM cPanel certificate not trusted - The security certificate presented by this website was not issued by a trusted certificate authority. Security certificate problems may indicate an attempt to fool you or intercept any data you send to the server

You can just press “Proceed Anyway” and get to WHH, cPanel or Webmail login but that will just bypass it but it becomes quite annoying.

The Solution
Well there are two actually. First one includes buying SSL Certificate and those come at price from about $10 to few hundred bucks per year. If you sell hosting – I would recommend buying and installing one – but if you’re using the server alone – you can do it this way:

1. Login to cPanel/WHM (you’re clicking “Proceed Anyway” button for the last time I promise 🙂 )

2. Go to SSL/TLS and select SSL Key/Crt Manager in the menu

3. In the Certificates find the your host and download click the download button/icon:
SSL Key Crt Manager

4. Copy everything from (including) —–BEGIN CERTIFICATE—– to (including) —–END CERTIFICATE—– and paste it in a notepad and save that as whmcert.crt on desktop.
SSL Certificate

5. Double click on that file you have just saved/created and click on Install Certificate button.
SSL install step 1

6. Just click Next > 🙂
SSL install step 2

7. This is important step for all Windows Vista, Windows 7 and Windows 8 users. Select Place all certificates in following store then click Browse and in new small windows select Trusted Root Certificate Authorities, press OK and Next >
SSL install step 3

8. Press Finish
SSL install step 4

9. Restart the browser

10. Navigate to WHM, cPanel or Webmail secure login and you should no longer have that red error warning!

As I’ve said if you’re in hosting business – don’t be cheap buy a real SSL and install it. If you share server with a friend(s) or a business partner(s) just zip that whmcert.crt and email it to them and email them this article as a guide how to install the certificate. They have to do it from point 5. to point 10. Hope this helps!


Disk space usage showing 0 Mb on VPS

I have just installed a cPanel on new VPS account but it’s simply not showing any disk usage even with quoatas turned on. I have tried running /scripts/fixquotas but it didn’t help and it returned error: quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option..

To make cPanel calculate disk usage you need to execute following commands:

touch /home/quota.user
touch /home/quota.group
chmod 600 /home/quota.user
chmod 600 /home/quota.group
quotacheck -acugvm

The result of the last command should look something like this:

quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.
quotacheck: Scanning /dev/sda [/] done
quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Old group file not found. Usage will not be substracted.
quotacheck: Checked 22164 directories and 750401 files
quotacheck: Old file not found.

By now it should work already but just to make sure execute quotas one more time

/scripts/fixquotas -force

That’s it!


When CSF firewal is enabled – ping reports lots of lost packets

I use just-ping.com when I need to ping my servers from various locations in the world to see if it’s working right. I have noticed that when CSF Firewall is installed and active I get losts of lost packets when trying to ping the server, but when I disable it – results are okay. The solution for this is to increase the ICMP_IN_RATE value from 1/s to 30/s.

To do so login to your WHM go to ConfigServer Security & Firewall and there click on Firewall Configuration button and on that page locate ICMP_IN_RATE (CTRL+F can help you locate it) and then increase it’s value from 1/s to 30/s. Scroll all the way down and pres “Change” button to save the changes. Restart the firewall and test it again.

Here’s a screenshot of what you need to chage:
csf ping problem solution

Now you should have good ping results at just-ping.com 🙂

04.12.2014 Update: Looks like the just-ping (now on new address cloudmonitor.ca.com) changed the way their service works. Now they ping you instantly from all places at once and CSF firewall will block most of these out and you’ll get lost packets in report. So for the testing you should set ICMP_IN_RATE to 0 – that will disable it – and then you can do tests. Other way around it to set it to fairly large number (200 or even bigger). Don’t forget to restart CSF + LFD in order these changes to apply.


How to add Iframes in WordPress posts or pages

A friend of mine needed some help. He wanted to place iframes inside WordPress posts but WordPress removes those codes automatically. So I searched for solutions and found this pretty simple one. All you need to do is to add these 4-5 lines of code to functions.php located in your theme’s folder.

function add_iframe($initArray) {
$initArray['extended_valid_elements'] = "iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]";
return $initArray;
}
add_filter('tiny_mce_before_init', 'add_iframe');

You can get there by going Appearance -> Editor -> Theme Functions (functions.php). If there’s no functions.php you’ll have to create one (to do so you must login to FTP or to your cPanel and create a functions.php file by hand in theme’s folder and then place this code in it. Don’t forget to open and close php segment.

Now WordPress will not remove iframes from your posts or pages!
Hope it helps!


WordPress 3.5 custom media upload path missing

After WordPress 3.5 was released many of useful options were removed or simply disabled because of some reason. One of those options is possibility to define custom path where you want your pictures (and other media files) to be uploaded. This is really important in case – you want to use CDN or you want to use some other web server to serve that static content (both are simply a must for medium and big sites).

So if you go to Settings -> Media in your WordPress (versions after 3.5) you will see something like this:
wordpres uploading files no custom paths

And it should look like this (versions prior 3.5):
wordpress uploading files with custom paths

In order to enable custom media upload paths go to phpMyAdmin and open Database of your WordPress 3.5 installation, then locate table wp_options (could be different depending on your prefix) and then those two option_name inputs:
phpmyadmin wp_options
And change them according to your needs.

Same domain just different folder Example
upload_path to images
upload_url_path to http://www.yoursite.com/images

Subdomain example
upload_path to images
upload_url_path to http://images.yoursite.com
– then go to cPanel and setup that subdomain like this
cPanel subdomains
cpanel making subdomain

After setting those two values in phpMyAdmin those two forms will appear in WordPress so you can change it’s values if needed. If this helped you out please post some comments. Also if you need any help or experience any problems – feel free to leave a comment.


Link Manager missing after on WordPress 3.5

If you have upgraded your WordPress installation to version 3.5 or have just made a fresh installation of it you have probably noticed that “Link Manager” or simply “Links” in control panel menu are missing. No you’re not nuts – it’s gone! This is because the new WordPress by default doesn’t use Link Manager any more. It’s still available in the code and sites upgrading to WordPress 3.5 should still be able to use it (if they used it before) but new installations (or upgrades who didn’t used it before) must install a plugin called Link Manager. So they have basically removed that option from WordPress into a plugin so if you need that option – simply install that plugin. Here’s a link with lots of geek informations about it.

UPDATE:
You can also enable it just by adding this single line of code in theme’s functions.php:

add_filter( 'pre_option_link_manager_enabled', '__return_true' );

WordPress “Hack by DR-MTMRD” solution

A friend of mine contacted me today saying that his WordPress got hacked and it shows just this message “Hack by DR-MTMRD” on a white page. After investigating I found out that the hacker just added a blank widget with some nasty code. Solution was just to remove (delete) a widget. As simple as that. Hope that it will help someone who has this problem. Here’s the widget picture:

Hack-by- DR-MTMRD-solution


FLV streaming using Apache + WHM/cPanel

Streaming FLV files with Apache + mod_flvx has never been easier. Setup your web server to stream FLV files using Apache in just 3 minutes.

cd /usr/local/src
wget http://people.apache.org/~pquerna/modules/mod_flvx.c
apxs -cia mod_flvx.c

If your system can’t find apxs locate it using

which apxs

You’ll get something like /usr/bin/apxs as result – that’s the path to it – you need it for next step

And then use full path to apxs to compile (for example):

/usr/bin/apxs -cia mod_flvx.c

Non WHM/cPanel users
Should now add those two lines into httpd.conf:

LoadModule flvx_module modules/mod_flvx.so
AddHandler flv-stream .flv

and simply restart Apache using:

service httpd restart

WHM/cPanel users
Should use Include Editor since any changes made to httpd.conf will be lost in case of rebuilding apache.
So login to WHM and go to Apache Configuration -> Include Editor -> Pre Main Include -> All Versions and in the box that appears copy/paste following two lines and after saving that confirm Apache restart.

LoadModule flvx_module modules/mod_flvx.so
AddHandler flv-stream .flv

Here are a few pictures for newbies so they can find their way trough more easily:

1. Apache Configuration
2. Include Editor
apache include editor whm cpanel

3. Locate PreMain Include – select All Versions
4. Copy/paste those two lines and press Update (then confirm Apache reload)
apache include editor whm cpanel

Setting up the player
If you use JW Player (that I strongly recommend) you need to set provider to value http.
jwplayer provider http
Visit JW Player setup wizard to easily install JW Player on your site.

MP4 Streaming using Apache
To learn how to setup MP4 streaming using Apache click here


Solution for the custom fileds problem with WordPress 3.4.2

No you are not nuts there really is a problem with custom fields in WordPress 3.4.2. If you have just updated to current latest version of WordPress 3.4.2 and have found out that the custom fields are not updating and are broken – you are not alone. Its happening for everybody. Its a known bug for WordPress 3.4.2. Here we have a quick fix before WordPress 3.4.3 (or 3.5) arrives. WordPress developers are aware of the bug (http://core.trac.wordpress.org/ticket/21829). The next milestone version will be WordPress 3.5 but since this is a critical bug its already fixed in rev.21780 so it could be released early on 3.4.3 but we just don’t know when is that going to happen.

Until then you can use WordPress hotfix plugin that will take care of this bug:
http://wordpress.org/extend/plugins/hotfix/

All you need to do is install it in your WordPress. Login to wp-admin and go to Plugins -> Add New in search box enter hotfix and install the first plugin from the results list (plugin Version 0.9, plugin author: Mark Jaquith). That’s it!


Solution for yum problems on new CentOS 6 + WHM installations

Recently I discovered problems trying to install anything using yum on new servers based on CentOS 6 (64-bit) + WHM/cPanel. I was trying to install subversion using yum:

yum install subversion

And I was getting following output:

Error: Package: subversion-1.6.11-7.el6.x86_64 (base)
           Requires: perl(URI) >= 1.17
 You could try using --skip-broken to work around the problem
** Found 5 pre-existing rpmdb problem(s), 'yum check' output follows:
bandmin-1.6.1-5.noarch has missing requires of perl(bandmin.conf)
bandmin-1.6.1-5.noarch has missing requires of perl(bmversion.pl)
bandmin-1.6.1-5.noarch has missing requires of perl(services.conf)
exim-4.77-1.x86_64 has missing requires of perl(SafeFile)
frontpage-2002-SR1.2.i386 has missing requires of libexpat.so.0

And I would get that trying to install just about anything with yum or by calling yum check.

To solve this problem you will have to open /etc/yum.conf for editing and to locate perl* in exclude= line and remove it (just perl* part). Now install anything by running the yum install package_name it will solve all those problems that you had! Once the installation is done and problems are solved, don’t forget to put perl* back to /etc/yum.conf in exclude= list!