Bulk update PHP handler cPanel

List existing handlers /usr/local/cpanel/bin/rebuild_phpconf –current Example Output: DEFAULT PHP: ea-php74 alt-php44 SAPI: cgi alt-php51 SAPI: cgi alt-php52 SAPI: cgi alt-php53 SAPI: cgi alt-php54 SAPI: cgi alt-php55 SAPI: cgi alt-php56 SAPI: cgi alt-php70 SAPI: cgi alt-php71 SAPI: cgi alt-php72 SAPI: cgi alt-php73 SAPI: cgi alt-php74 SAPI: cgi alt-php80 SAPI: cgi alt-php81 SAPI: cgi ea-php51 SAPI: cgi … Read more

Create a list of wp-config.php on a cPanel server.

Sometimes it is necessary to edit in bulk all wp-config.php form all WordPress websites that are present in a cPanel server. We can start build that list first, then we can use commands like sed in order to bulk modify settings. This is just the method to generate this list: find /home -type f -name … Read more

Add Custom Directory to All cPanel Accounts

Assuming that you have a cPanel server with a CentOS7 or CloudLinux 7 operating system, and you want to insert in each home directory a custom directory, here are the commands that help to do that: cd /home for i in *; do if [[ -d $i/public_html ]]; then mkdir $i/_CUSTOM_DIRECTORY; chown $i: $i/_CUSTOM_DIRECTORY; fi … Read more

WHM / cPanel List IP’s Cheatsheet

List all IP’s, via API whmapi1 listips Count IP’s, including main IP whmapi1 listips | grep public_ip | wc -l List all IP’s, including main IP whmapi1 listips | grep public_ip | awk ‘{print $2}’ List all IP’s from /etc/ips (this doesn’t include the main IP) cat /etc/ips List dedicated IP / domain association cat … Read more

Update cPanel database cache

In order to manually clear the database usage cache you can use the following command: /usr/local/cpanel/scripts/update_db_cache

The Right Way of Updating The cPanel Hostname

There are 2 ways to update the cPanel hostname corectly, via WHM, and via the Hostname utility. In both cases, the hostname should be a FQDN (Fully Qualified Domain Name) and need to resolve in DNS (have an A record present). For mail deliverability reasons, the PTR record of the main cPanel IP should match … Read more

Enable / Disable Terminal UI cPanel

Command line script to disable the web ui touch /var/cpanel/disable_whm_terminal_ui Command line script to enable the web ui rm -f /var/cpanel/disable_whm_terminal_ui

Verify and sync the cPanel license

Website to verify the cPanel license https://verify.cpanel.net/app/verify Script to force sync the cPanel license inside the server: /usr/local/cpanel/cpkeyclt –force

List all cPanel domains

This command will list all cPanel domain names, using WHM whmapi1 listzones command: whmapi1 listzones | grep domain: | awk {‘print $2’} 2. This command will list all cPanel domain names and their corresponding cPanel account cat /etc/domainusers 3. This is the command to find the cPanel account that owns a domain name: /scripts/whoowns exampledomain.com

Exim Cheatsheet

How to list email count with sender information from the Exim mail queue ? Syntax: exim -bp|grep “<“|awk {‘print $4’}|cut -d”<” -f2|cut -d”>” -f1|sort -n|uniq -c|sort -nr Where: exim -bp : Is the base command to list all email in the mail queue with its details. grep “<” : To grep out the Sender address … Read more