Results 1 to 3 of 3

Thread: PHP COM error

  1. #1
    Join Date
    Dec 2011

    PHP COM error

    Hi all ,

    I'm trying to use PHP COM class , working fine with me on my local server ..

    But online : I on my godaddy VPS ( windows server 2008 , Plesk ) , When trying to use COM , the following error appear :

    PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': Invalid syntax ' in C:\Inetpub\vhosts\ajobsy.secureserver.net\httpdocs\index.php:17 Stack trace: #0 C:\Inetpub\vhosts\ajobsy.secureserver.net\httpdocs\index.php(17): com->com('word.applicatio...') #1 {main} thrown in C:\Inetpub\vhosts\ajobsy.secureserver.net\httpdocs\index.php on line 17
    Line 17 is the following:
    PHP Code:
    $word = new COM("word.application") or die ("Could not initialise MS Word object."); 
    Note : PHP is running as CGI application ..
    What should I do ?

  2. #2
    Join Date
    Sep 2013
    Go to php.ini and add this line. After that, restart php server. Good luck to you


    and In PHP 5, potentially fatal COM errors result in the COM
    extension throwing instances of the class com_exception.
    So your script needs to catch those exceptions:

    function getWinDir() {
    try {
    } catch (com_exception $e) { .... }

    You can also try out with the below link:

    Hope this helps.
    strad solutionswww.stradsolutions.com

  3. #3
    Join Date
    Nov 2002
    Baltimore, Maryland
    Adjust the INI file is part two of the problem.

    In order to use the Word through the PHP COM class the server has too be running Windows and it has to have Word installed.

    You might have to drop back and edit an RTF instead.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center