PHP calls COM components

Source: Internet
Author: User
PHP to turn on COM components

1. Open COM option first to php.ini, com.allow_dcom = True

2. my environment Here is PHP5.4.7,after PHP 5.4.5, the Com/dotnet module has become a separate extension, so you need to configure Extension=php_com_dotnet.dll in php.ini , if PHP version<5.4.5 is not required. Otherwise, it might be an error Fatal Error:class ' COM ' not found.

The configuration method is: Simply add extension=php_com_dotnet.dll in the extension list

After the configuration is complete, you can test the statement

$word = new COM ("Word.Application") or Die ("Unable to instanciate word");

Print "Loaded Word, Version {$word->version}\n";

The above statement must have Office installed on the computer to

The OpenOffice is:

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

The above describes the PHP call COM components, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.