Microsoft strongly advises not to use the automation of Office documents via COM objects. It quotes the following −
“Microsoft does not currently recommend or support the Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.”
A .docx file can be created without COM objects since it has XML foundations (PHPDOCX could be used for this).
An added advantage of this method is that a local copy of Word that was installed wouldn’t have to be created (for the .docx files).
It can be used on a Linux server as well.