As yours is not too detailed in your question about your specific requirements or server settings, this will help you get started as well as answer the question.
<?php
$DocumentPath="C:/xampp/htdocs/test.doc";
$word = new COM("word.application") or die("Unable to instantiate application object");
$wordDocument = new COM("word.document") or die("Unable to instantiate document object");
$word->Visible = 0;
$wordDocument = $word->Documents->Open($DocumentPath);
$HTMLPath = substr_replace($DocumentPath, 'html', -3, 3);
$wordDocument->SaveAs($HTMLPath, 3);
$wordDocument = null;
$word->Quit();
$word = null;
readfile($HTMLPath);
unlink($HTMLPath)
?>
source
share