PHP error Fatal Error:class COM not found in

Source: Internet
Author: User
Tags php error

Fatal error:class ' COM ' not found in xxxxxxxxx

No COM class found

Cause analysis

Check to see if Php_com_dotnet.dll exists under the PHP Directory ext folder

Workaround:

★extension_dir ext Path is correct
★ENABLE_DL = On
★php the root directory of the Ext folder to ensure the existence of Php_com_dotnet.dll this file
★php.ini Make sure that you have this statement


[Php_com_dotnet]

Extension=php_com_dotnet.dll//is added one line, not open

Com.allow_dcom = True

★ Start > Run > Services.msc carriage return > Ensure that COM + Event System services are turned on
Before PHP version 5.4.5 was built, but later versions were separated

Then restart IIS or Apache, it's normal to run again!


after the configuration is complete, you can test with the following code:

Word = new COM ("Word.Application") or Die ("Unable to instanciate word");
Print "Loaded Word, Version {word->version}\n";

The above statement this machine must have Office installed to do so.

The OpenOffice are as follows:

$obj = new COM ("Com.sun.star.ServiceManager") or Die ("Unable to instanciate Word");

Here is a small example: (Note the path to open)

Word=newcom ("Word.Application") Ordie ("Unabletoinstanciateword");p rint "loadedword,version$word−>version\n"; /place its front word->visible = 0;
Open a document
Word−>documents−>open ("D:\wamp\www\test\1.doc"); do something. Echo word->activedocument->content->text ;
Close Word
$word->quit ();

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.