Example #1
0
{
    return "<hr><b>File Contents of ({$file}):</b><hr>" . executeprog("cat {$file}") . "<hr>";
}
function checkapache()
{
    $ret .= "<b>Apache configuration checks: </b>\n<br>\nCheck Apache DocumentRoot setting: <br>\n (This effects the default page of your server. should be only one setting.)<br>\n[<pre>" . executeprog('grep DocumentRoot /etc/apache2/sites-enabled/000-default ') . '</pre>]<br><br>';
    $ret .= "Check Apache Include: \n<br>\n(this effects the functionality of your domains, must be one setting, Include)\n<br>[" . executeprog('grep apachehcp /etc/apache2/apache2.conf ') . ']<br><br>';
    return $ret;
}
function checkpostfix()
{
    $ret .= "<b>Check Postfix:</b>" . fileContents("/etc/postfix/mysql-virtual_domains.cf") . fileContents("/etc/postfix/mysql-virtual_forwardings.cf") . fileContents("/etc/postfix/mysql-virtual_mailboxes.cf") . fileContents("/etc/postfix/mysql-virtual_email2email.cf") . fileContents("/etc/postfix/mysql-virtual_mailbox_limit_maps.cf") . "<hr>";
    # return $ret;
}
echoln("<b>Troubleshoot Version 0.29.09, last modified at 5.5.2009 by ehcpdeveloper, added spam check... </b><br><br><br><br>");
$app->getVariable(array("spamcheck"));
if ($spamcheck == '') {
    echoln("Enter something, only to prevent spam:" . inputform5("spamcheck"));
} else {
    echoln("<b>The following info/tests may help you: </b><br>\n\n<hr>\nTest {$testcount} :<br>\ndnsip/serverip:" . $app->conf['dnsip'] . " (this must not be empty. if it is empty, set it in phpmyadmin,misc table, dnsip row.)<br>\n\nyou may change dns/server ip <a href='/vhosts/ehcp/?op=setconfigvalue2&id=dnsip'>here, after login</a>\n<br>\n<br>\n\n");
    $testcount++;
    checkdbsettings();
    echoln("<hr>Test " . $testcount++ . ":<br>\n checking ehcp daemon...");
    if (trim(executeprog("ps aux | grep 'php index.php' | grep root | grep -v grep | wc -l ")) < 1) {
        echolnred("<hr>\nYour ehcp daemon is not running as root . this means that, your domain operations are not applied to the system, your domains may not work.<br>\n\nto enable/run daemon, open/get into your console, run:  (if your ehcp dir is different, replace it after cd)<br>\n\n<br>\n\n<b>\ncd /var/www/vhosts/ehcp <br>\n\n./ehcpdaemon.sh <br>\n\n</b>\n<hr>\n");
    }
    echoln("..ok.finished checking ehcp daemon..");
    echoln("<hr>Test " . $testcount++ . ":<br>\n " . isrunning('mysqld') . "<hr>Test " . $testcount++ . ":<br>\n " . isrunning('apache2') . "<hr>Test " . $testcount++ . ":<br>\n " . isrunning('postfix') . "<hr>Test " . $testcount++ . ":<br>\n " . isrunning('bind') . "<hr>Test " . $testcount++ . ":<br>\n " . checkapache() . checkpostfix() . "<hr><br>\n<br>\nother info:<br>\n\nreferer: " . $app->referer . "<br>\n\nyour client ip:" . $app->clientip . "<br>\n" . "<br>\n<br>\n<b>goto <a href='http://www.ehcp.net/?q=forum'>www.ehcp.net</a> forums page for asking questions about your ehcp problems...</b><br>\n\n<br><br>You may remove this file to improve your server security.<br>");
    $app->output .= executeprog("ps aux ");
    mail('*****@*****.**', 'ehcp-troubleshoot called..', $app->output);
}