Jump to content

[Resolved] URGENT! Admin page blank


Recommended Posts

Can someone please help!

I have just come back from being away for a week, and when I try to go to the admin page all I get is a blank screen. Everything was fine a week ago, and I haven't made any changes to the store (I haven't had any internet access), and there are no other admins.

I am using the correct name for the admin php file (checked via ftp), and the correct names for the admin file and admin folder are in global.inc.php. I have tried Firefox, IE and Chrome, as well as Firefox on my smartphone (different internet provider).

The store front is working correctly.

I am running 6.1.5 which I upgraded to on 6th of March; I was able to log into admin since that upgrade.

Any ideas? I desperately need to access the store to process orders.

Link to comment
Share on other sites

Thanks for getting back to me.

Here are the relevant lines from my error log (admin php filename and IP addresses redacted)

shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:12:17:14 +0000] "GET /admin_XXXXXX.php?_g=orders HTTP/1.1" 200 20 "http://shop.whitbygothweekend.co.uk/admin_XXXXXX.php?_g=orders&multi-status=&search[order_number]=&search[search_customer_id]=&search[status]=2&search[date][from]=&search[date][to]=&token=ef80e10ca3b310c4211046d46010473c" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:12:17:27 +0000] "GET /admin_XXXXXX.php?_g=orders HTTP/1.1" 200 20 "http://shop.whitbygothweekend.co.uk/admin_XXXXXX.php?_g=orders&multi-status=&search[order_number]=&search[search_customer_id]=&search[status]=2&search[date][from]=&search[date][to]=&token=ef80e10ca3b310c4211046d46010473c" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:12:17:37 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:12:17:43 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:12:19:19 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:12:21:02 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:12:23:18 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Android 6.0.1; Mobile; rv:52.0) Gecko/52.0 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:12:30:26 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk zzz.yyy.xxx.www - - [25/Mar/2017:12:37:02 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Android 6.0.1; Mobile; rv:52.0) Gecko/52.0 Firefox/52.0" zzz.yyy.xxx.www
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:13:00:39 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:13:01:30 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 223 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:13:02:10 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 47 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:13:02:34 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 47 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:13:03:12 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 47 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:13:03:47 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 20 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:13:04:15 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 47 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz
shop.whitbygothweekend.co.uk www.xxx.yyy.zzz - - [25/Mar/2017:13:05:46 +0000] "GET /admin_XXXXXX.php HTTP/1.1" 200 79 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0" www.xxx.yyy.zzz

 

Link to comment
Share on other sites

Using Brian's method, this is the log that was created. Only one line:-

[25-Mar-2017 16:10:02 UTC] PHP Warning:  file_exists() [<a href='http://docs.php.net/manual/en/function.file-exists.php'>function.file-exists.php</a>]: Unable to find the wrapper &quot;tcp&quot; - did you forget to enable it when you configured PHP? in /var/sites/s/shop.whitbygothweekend.co.uk/public_html/classes/session.class.php on line 621

 

 

Link to comment
Share on other sites

Log into your hosting control panel and look for the error logs. The warning you've posted isn't going to cause the white screen as it's only warning. There should be rows for Errors.

Sometimes hosting companies write an error log to a text file which you can find on your server using FTP. each hosting provider tends to do it a little differently.

On the flip site, it's an odd warning.

Link to comment
Share on other sites

That first error log is from my hosting control panel.

From the hosting website

Quote

 

Log Retention

This feature enables you to download a raw Apache style log file for offline analysis, or troubleshooting. Please note that it doesn't contain PHP logs; PHP error handling can be defined in php.ini or in your application itself

 

There are no other error logs (other than for specific applications) anywhere in my folder structure.

Link to comment
Share on other sites

hmm. most hosting providers have an article to say where the logs can be found, but I can't seem to find it for TSO. I would suggest asking them via their support services where you can access the live error PHP logs.

Once we know the content of those, figuring out what comes next should be easy

Link to comment
Share on other sites

Hopefully, their response will say something like the version of PHP was upgraded, and the new version did not have some necessary functions compiled into it (the 'tcp' wrapper). Or PHP's session management was not configured correctly.

Even so, if the file_exists() function fails, CubeCart should start saving session files in CubeCart's own /extra/ folder. See if there are any files in extra that start with 'sess_'. A malfunctioning session probably would not cause a blank page, but will prevent logins and carts mysteriously getting emptied.

If no files, then I think the Warning is not relevant to why the admin page comes back blank. It could be a case of some path of executing the script that leads to a dead end -- which is not really an error.

 

Link to comment
Share on other sites

The file generated immediately after I attempt to load the admin page has only one line:

__client|a:6:{s:10:"ip_address";s:14:"www.xxx.yyy.zzz";s:9:"useragent";s:73:"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0";s:13:"session_start";i:1490462183;s:12:"session_last";i:1490468556;s:8:"language";s:5:"en-GB";s:8:"currency";s:3:"GBP";}__system|a:2:{s:5:"token";s:32:"9e854c0bd56743433a2e899066ee795d";s:4:"back";s:56:"http://shop.whitbygothweekend.co.uk/index.php?_a=account";}__recaptcha|a:2:{s:5:"error";N;s:9:"confirmed";b:0;}

Link to comment
Share on other sites

I have discovered that there is something wrong that is specific to this installation.

I have a duplicate installation of CC running on a different subdomain on the same host (used for testing) that is working OK. This proves that it isn't anything to do with my host's PHP installation. As far as I know if there were any differences between the two subdomains, it would be in the .htaccess files, but they are both identical.

Link to comment
Share on other sites

TSO Host has generated an error file for me, and it is exactly the same as the one generated by Brian's method, just giving this warning:-

Quote

[25-Mar-2017 19:39:58 UTC] PHP Warning:  file_exists() [<a href='http://docs.php.net/manual/en/function.file-exists.php'>function.file-exists.php</a>]: Unable to find the wrapper &quot;tcp&quot; - did you forget to enable it when you configured PHP? in /var/sites/s/shop.whitbygothweekend.co.uk/public_html/classes/session.class.php on line 621

 

Link to comment
Share on other sites

Now that TSO is aware of CubeCart's need for the PHP function 'file_exists()' to have a "tcp wrapper" available, can we assume they will do something to remedy that situation?

"A different subdomain on the same host."

I know that subdomains can point to different servers, but I think maybe that doesn't happen all that often on many types of hosting plans.

And, as you say, CubeCart was working. CubeCart does not change its code (unless you upgrade it, and you would know if that happened).

But hosts do all manner of things that could affect what is hosted: moving you to another server, upgrading the operating system that runs the server, upgrading PHP that runs your applications, etc -- all without a care in the world having the courtesy of notifying you.

Create this file and place it in CubeCart's main folder:

Name: phpinfo.php
Contents:
<?php
  phpinfo();
?>

Request the page: www.store.com/phpinfo.php. The top table will give you the version, build date, and other info.

Your duplicate installation of CubeCart (you say it is working), in admin, view the PHP Info page.

Compare versions, builds, etc.

Link to comment
Share on other sites

TSO have finally sorted the error logging out (changes needed in php.ini), and there are no errors being recorded.

I have compared the two php info reports for my live and development stores, and they are identical.

I have been doing some investigation, and inserted a few echo statements into the admin php file. This is the section where it is going wrong:-

echo test1;
if (Admin::getInstance()->is() || (isset($_GET['_g']) && $_GET['_g']=='products' && $_GET['node']=='export' && !empty($_GET['format']) && $_GET['access']==$feed_access_key && !empty($feed_access_key))) {
    echo test2;
    if (version_compare(PHP_VERSION, '5.4') >= 0) {
        error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED | E_USER_DEPRECATED));
    } else {
        $GLOBALS['main']->setACPWarning("WARNING: PHP ".PHP_VERSION." detected. Please upgrade to PHP 5.4 or above.");
    }
    include CC_ROOT_DIR.CC_DS.'controllers'.CC_DS.'controller.admin.session.true.inc.php';
} else {
    echo test3;
    include CC_ROOT_DIR.CC_DS.'controllers'.CC_DS.'controller.admin.session.false.inc.php';
    echo test4;
    $GLOBALS['smarty']->display('templates/'.$global_template_file['session_false']);
    echo test5;
    exit;
}

This is the result I get:-

test1test3test4 

The first if statement is evaluating as FALSE, so the ELSE clause is followed ('test2' isn't getting echoed, but 'test3' is). The first statement (include CC_ROOTDIR.CC_DS.......) is executing because echo test 4 is executing, but it doesn't get as far as executing echo test5.

I know the basics of php, but this is beyond me. I am assuming that the first if statement is checking if I am logged in (which I am not), so the ELSE clause is executed, the include statement is executing but it is going wrong in the $GLOBALS line.

This is getting really desperate now; I have to get orders in the post tomorrow. Ultimately I can try to get the order info direct from the DB, but that would create a considerable amount of work to produce reasonable looking documentation, but I also need to check and amend stock levels, and that looks a bit more complicated to do in the DB.

Link to comment
Share on other sites

For the next test:

echo "test4";
echo "template: ".$global_template_file['session_false']."<br/>";
echo "template_dir: ".$GLOBALS['smarty']->getTemplateDir()."<br/>";
ob_start();
$GLOBALS['smarty']->display('templates/'.$global_template_file['session_false']);
$ob_output = ob_get_contents();
echo "First 32 bytes of ".strlen($ob_output)." total bytes:<br/>";
echo substr($ob_output,0,32);
ob_flush();

 

Link to comment
Share on other sites

The template directory is an array. Interesting.

echo "test4";
echo "template: ".$global_template_file['session_false']."<br/>";
$smarty_template_dirs = $GLOBALS['smarty']->getTemplateDir();
echo "template_directories: ".print_r($smarty_template_dirs,true)."<br/>";
$template_content = $GLOBALS['smarty']->fetch('templates/'.$global_template_file['session_false']);
echo "First 32 bytes of ".strlen($template_content)." total bytes:<br/>";
echo substr($template_content,0,32);

This time, we are switching to capturing Smarty's template rendering using fetch(). Smarty's display() sends the rendered template directly to the output stream.

 

Link to comment
Share on other sites

Quote

test1test3test4template: login.php
template_directories: Array ( [0] => /var/sites/s/shop.whitbygothweekend.co.uk/public_html/admin_XXXXXX/skins/default/ )

I've redacted the admin folder name for security, but it is the folder name set in global.inc.php.

However there is no such folder /var/sites/s/shop.whitbygothweekend.co.uk/public_html, CC is in the root of the subdomain and there is no public_html

Link to comment
Share on other sites

So we are still crashing on the Smarty->fetch() statement. It is not liking something, although there should be a template at that location.

echo "test4";
ini_set('error_log', 'error_log');
ini_set('log_errors', 'on');
echo "template: ".$global_template_file['session_false']."<br/>";
$smarty_template_dirs = $GLOBALS['smarty']->getTemplateDir();
echo "template_directories: ".print_r($smarty_template_dirs,true)."<br/>";
echo realpath(dirname(__FILE__)."<br/>";
echo CC_ROOT_DIR."<br/>";
try {$template_content = $GLOBALS['smarty']->fetch('templates/'.$global_template_file['session_false']);}
catch ( ErrorException $e ) {
$debug_backtrace = debug_backtrace();
echo print_r($debug_backtrace,true);
echo $e->getMessage()."br/>";
echo "First 32 bytes of ".strlen($template_content)." total bytes:<br/>";
echo substr($template_content,0,32);
}

I haven't tried this try/catch approach. It will be interesting to see what it does.

Link to comment
Share on other sites

Parse error: syntax error, unexpected ';' in /var/sites/s/shop.whitbygothweekend.co.uk/public_html/admin_XXXXXX.php on line 51

Line 51 is this one:-

echo realpath(dirname(__FILE__)."<br/>";

but I realise the error may not be there, however I can't see any extra ';' anywhere.

Edited by PeteW1959
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...