CCSupport Posted December 4, 2014 Share Posted December 4, 2014 Hello all, Having some interesting issues after migrating WHMCS (5.3.10) from a Windows 2008 R2 box to a Centos 6.6 WHM box. After migrating the content and changing the syntax within the configuration.php file we are getting a blank page after trying to login. However, after turning on php errors (adding $display_errors = true; to the config file) it shows the following error: Parse error: syntax error, unexpected 'die' (T_EXIT) in /home/[username]/public_html/modules/widgets/system_overview.php on line 1 So, I renamed the specific file and it just showed the error with a different file within the /widgets folder. So I renamed the /Widgets folder....and it worked...well it worked in the sense of I could login, however obviously no Widgets were showing. See below for the content of the 'system_overview.php' file....again the other files do this but thought I would show the content just in case: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function widget_system_overview($vars) { global $whmcs,$_ADMINLANG; $title = $_ADMINLANG['home']['sysoverview']; if ($whmcs->get_req_var('getsystemoverview')) { $activeclients = get_query_val("tblclients","COUNT(id)","status='Active'"); $totalclients = get_query_val("tblclients","COUNT(id)",""); $clientsactive = ($activeclients==0 || $totalclients==0) ? '0' : round((($activeclients/$totalclients)*100),0); $activeservices = get_query_val("tblhosting","COUNT(id)","domainstatus='Active'"); $totalservices = get_query_val("tblhosting","COUNT(id)",""); $servicesactive = ($activeservices==0 || $totalservices==0) ? '0' : round((($activeservices/$totalservices)*100),0); $unpaidinvoices = get_query_val("tblinvoices","COUNT(id)","status='Unpaid'"); $overdueinvoices = get_query_val("tblinvoices","COUNT(id)","status='Unpaid' AND duedate<'".date("Ymd")."'"); $overduestatus = ($overdueinvoices==0 || $unpaidinvoices==0) ? '0' : round((($overdueinvoices/$unpaidinvoices)*100),0); echo ' <table width="100%"> <tr> <td width="150">Clients</td> <td> <div class="percentbar"> <div class="active" style="width:'.$clientsactive.'%">'.$clientsactive.'% Active</div> </div> </td> <td class="totals">'.$totalclients.'</td> </tr> <tr> <td>Services</td> <td> <div class="percentbar"> <div class="active" style="width:'.$servicesactive.'%">'.$servicesactive.'% Active</div> </div> </td> <td class="totals">'.$totalservices.'</td> </tr> <tr> <td>Unpaid Invoices</td> <td> <div class="percentbar"> <div class="overdue" style="width:'.$overduestatus.'%">'.$overduestatus.'% Overdue</div> </div> </td> <td class="totals">'.$unpaidinvoices.'</td> </tr> </table> '; exit; } $adminusername = get_query_val("tbladmins","username",array("id"=>$vars['adminid'])); $lastlogin = get_query_vals("tbladminlog","lastvisit,ipaddress",array("adminusername"=>$adminusername),"lastvisit","DESC","1,1"); $lastlogindate = ($lastlogin[0]) ? fromMySQLDate($lastlogin[0],true) : '(None Recorded)'; $lastloginip = ($lastlogin[1]) ? $lastlogin[1] : '-'; $content = ' <style> #systemoverviewstats { display: none; } #systemoverviewstats div.percentbar { width: 100%; height: 24px; border: 1px solid #ccc; background-color: #efefef; } #systemoverviewstats div.percentbar div.active { height: 24px; line-height: 24px; background-color: #84B429; color: #fff; font-weight: bold; text-align: center; overflow: hidden; } #systemoverviewstats div.percentbar div.overdue { height: 24px; line-height: 24px; background-color: #cc0000; color: #fff; font-weight: bold; text-align: center; } #systemoverviewstats td { text-align: center; font-weight: bold; height: 35px; } .lastlogin { margin-bottom:5px; padding:3px; text-align: center; } </style> <div id="systemoverviewstats">'.$vars['loading'].'</div> <div class="lastlogin">'.$_ADMINLANG['home']['lastlogin'].': <strong>'.$lastlogindate.'</strong> '.$_ADMINLANG['home']['lastloginip'].' <strong>'.$lastloginip.'</strong></div> '; $statusfilter = array(); $result = select_query("tblticketstatuses","title",array("showawaiting"=>"1")); while ($data = mysql_fetch_array($result)) { $statusfilter[] = $data[0]; } if (count($statusfilter) > 0) { $result = full_query("SELECT COUNT(*) FROM tbltickets WHERE status IN (".db_build_in_array($statusfilter).")"); $data = mysql_fetch_array($result); $ticketsawaitingreply = $data[0]; } else { $ticketsawaitingreply = 0; } $result = full_query("SELECT COUNT(*) FROM tblcancelrequests INNER JOIN tblhosting ON tblhosting.id=tblcancelrequests.relid WHERE (tblhosting.domainstatus!='Cancelled' AND tblhosting.domainstatus!='Terminated')"); $data = mysql_fetch_array($result); $cancellationrequests = $data[0]; $result = full_query("SELECT COUNT(*) FROM tbltodolist WHERE status!='Completed' AND status!='Postponed' AND duedate<='".date("Y-m-d")."'"); $data = mysql_fetch_array($result); $todoitemsdue = $data[0]; $result = full_query("SELECT COUNT(*) FROM tblnetworkissues WHERE status!='Scheduled' AND status!='Resolved'"); $data = mysql_fetch_array($result); $opennetworkissues = $data[0]; $jquerycode = 'jQuery.post("index.php", { getsystemoverview: 1 }, function(data){ jQuery("#systemoverviewstats").html(data); jQuery("#systemoverviewstats").slideDown(); jQuery("#sysoverviewbanner").html("<div style=\"margin:0 0 -5px 0;padding: 10px;background-color: #FBEEEB;border: 1px dashed #cc0000;font-weight: bold;color: #cc0000;font-size:14px;text-align: center;-moz-border-radius: 10px;-webkit-border-radius: 10px;-o-border-radius: 10px;border-radius: 10px;\">'.$_ADMINLANG['global']['attentionitems'].': <a href=\"supporttickets.php\">'.$ticketsawaitingreply.' '.$_ADMINLANG['stats']['ticketsawaitingreply'].'</a> - <a href=\"cancelrequests.php\">'.$cancellationrequests.' '.$_ADMINLANG['stats']['pendingcancellations'].'</a> - <a href=\"todolist.php\">'.$todoitemsdue.' '.$_ADMINLANG['stats']['todoitemsdue'].'</a> - <a href=\"networkissues.php\">'.$opennetworkissues.' '.$_ADMINLANG['stats']['opennetworkissues'].'</a></div>"); });'; return array('title'=>$title,'content'=>$content,'jquerycode'=>$jquerycode); } function widget_system_overview_home_banner() { $roleid = WHMCS_Admin::getRoleID(); $widgets = get_query_val("tbladminroles","widgets",array("id"=>$roleid)); $widgets = explode(',',$widgets); $banner = (in_array('system_overview',$widgets)) ? '<div id="sysoverviewbanner"><div style="margin:0;padding: 10px;background-color: #FBEEEB;border: 1px dashed #cc0000;font-weight: bold;color: #cc0000;font-size:14px;text-align: center;"><img src="images/loading.gif" /></div></div>' : ''; return $banner; } add_hook("AdminHomeWidgets",1,"widget_system_overview"); add_hook("AdminHomepage",1,"widget_system_overview_home_banner"); /* #systemoverviewstats div { float: left; margin: 3px; padding: 5px; width: 30%; line-height: 24px; min-width: 250px; border: 1px solid #d9d9d9; background-color: #f2f2f2; -moz-border-radius: 4px; -webkit-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; overflow: hidden; } #systemoverviewstats div:hover { cursor: hand; cursor: pointer; } #systemoverviewstats div:hover a.view { color: #1A4D80; background-color: #fff; border: 1px solid #1A4D80; } #systemoverviewstats div div.statval { margin: 0 5px 0 0; padding: 0; min-width: 60px; font-family: Trebuchet MS,Tahoma; font-size: 24px; color: #777; text-decoration: none; text-align: center; border: 0; overflow: hidden; } #systemoverviewstats div a.view { float: right; margin: 0; padding: 0 7px; font-family: Tahoma; font-size: 20px; text-transform: uppercase; text-decoration: none; color: #fff; background-color: #1A4D80; border: 1px solid #1A4D80; -moz-border-radius: 4px; -webkit-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; } #systemoverviewstats div a.view:hover { color: #1A4D80; background-color: #fff; border: 1px solid #1A4D80; } */ As it says Line 1....this is the '<?php' code....which is in all of the files as it should be..... Anyone have any ideas on this one? Cheers - - - Updated - - - Just seen that to show more error messages I needed to add - $display_errors = true; $display_errors = E_ALL; I only added the top line to begin with. So, here's what it's saying after adding the above with the /widget folder named correctly: Warning: ini_set() has been disabled for security reasons in /home/[username]/public_html/includes/classes/WHMCS/Terminus.php on line 0 Warning: Cannot modify header information - headers already sent by (output started at /home/[username]/public_html/includes/classes/WHMCS/Terminus.php:0) in /home/[username]/public_html/includes/classes/WHMCS/Application.php on line 0 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/[username]/public_html/includes/classes/WHMCS/Terminus.php:0) in /home/[username]/public_html/includes/classes/WHMCS/Session.php on line 0 Parse error: syntax error, unexpected 'die' (T_EXIT) in /home/[username]/public_html/modules/widgets/system_overview.php on line 1 0 Quote Link to comment Share on other sites More sharing options...
mbit Posted December 4, 2014 Share Posted December 4, 2014 Do you have a whitespace before the "<?php"? Is that file maybe UTF-8 encoded with the Byte Order Mark? If so, try saving it as UTF-8 without BOM. 0 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted December 4, 2014 Author Share Posted December 4, 2014 No whitespace. The weird thing is these files have come directly from a working installation of WHMCS. I am just reuploading the files as a complete set and see if that works. All main files are the same format as received within the normal WHMCS installation package. 0 Quote Link to comment Share on other sites More sharing options...
ICTU LTD Posted December 4, 2014 Share Posted December 4, 2014 No whitespace. The weird thing is these files have come directly from a working installation of WHMCS. I am just reuploading the files as a complete set and see if that works. All main files are the same format as received within the normal WHMCS installation package. Hi CCSupport, How did you get on with the install? Try uploading the 'system_overview.php' file on its own if you just want to migrate the old install. See if you get any errors thrown at you then. Also if you don't have many plugins / addons installed in the WHMCS you are migrating from just do a clean install and then a database import. Just make sure the version you install matches the version of the one the database is from. That would be an easy option. Thanks, Ben. 0 Quote Link to comment Share on other sites More sharing options...
CCSupport Posted December 5, 2014 Author Share Posted December 5, 2014 Thanks for the input and reply. Great news is that this issue has been resolved by WHMCS Support....Chance was great and took a look at the files. Turns out the new Linux box didn't like a script blocker that we used to use within WHMCS. As it was not in the Widget folder it was harder to find...but all sorted....well...until the next issue that is! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.