The below code check that post have category or not. If post have category then it will display list of category separate by comma. You can try this code. Hope this will help you.
if(has_category())
{
echo $cats_list = get_the_category_list(', ');
}