Domain Missing in WHM Mass Operations
When running Mass Enable and Mass Disable operations in LiteSpeed's WHM plugin, a list of the server's domains is displayed. The plugin should automatically detect and display all domains, but what if it doesn't?
Fatal WordPress Error
If the WHM plugin encounters a fatal error when trying to load the WordPress environment, the domain will be removed from the list of those automatically detected. In order to solve this problem, you need to determine what has caused WP's fatal error.
Possible Cause: Undefined Function
One possible cause for a fatal error is a call to an undefined function.
The WHM plugin loads WordPress with the SHORTINIT
constant. SHORTINIT collects basic information and prevents the bulk of WP from being loaded. This is the most efficient way for our plugin to gather what it needs from each WP installation on your server.
If you are calling functions in wp-config.php
, they may cause a fatal WP error in a SHORTINIT situation.
For example, say you have a line like this in your wp-config file:
update_option('siteurl', 'http://example.com' );
The update_option()
function uses another function, sanitize_option()
, in its code, but sanitize_option()
has not been loaded because of the SHORTINIT
constant. This results in the fatal WP error that causes the WHM plugin to skip over that domain in its list of detected domains.
The Solution
If you are calling functions as part of your wp-config file, you'll need to verify that they are not, in turn, using undefined functions. If they are, you can add a simple conditional statement to your code to avoid a fatal error. Like so:
if ( function_exists('sanitize_option') ) { update_option('siteurl', 'http://example.com' ); }
A more generic example:
If function1()
calls function2()
and function2()
is undefined when loading WP with SHORTINIT
, then you can replace this:
function1();
with
if ( function_exists('function2') ) { function1(); }
Troubleshooting
In the above example, the problem was easily found one function deep in the code, but that will not always be the case. To ferret out where the error is happening, you may need to do one or both of the following things:
- Check the WordPress error log for the missing domain.
- Follow the trail in the WordPress Codex Function Reference to see which functions use which other functions.