如何在cpanel中的代码下面运行


How to run below the code in cpanel

我在下面使用了将PPT转换为IMG 的代码

<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?php
    $ppApp = new COM("PowerPoint.Application");
    $ppApp->Visible = True;
    $strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); 
    $FileName = "MyPP";
    $ppName = "MySlides.ppt";

    //*** Open Document ***//
    $ppApp->Presentations->Open(realpath($ppName));
    //*** Save Document ***//
    $ppApp->ActivePresentation->SaveAs($strPath."/".$FileName,17);  //'*** 18=PNG, 19=BMP **'
    //$ppApp->ActivePresentation->SaveAs(realpath($FileName),17);
    $ppApp->Quit;
    $ppApp = null;
?>
PowerPoint Created to Folder <b><?php $FileName?></b>
</body>
</html>

它只在http://localhost中工作,但如果我在web服务器(cpanel托管位置)位置使用相同的代码,它将显示以下错误。

致命错误:在第9行的/home/domainname/public_html/index.php中找不到类"COM"

您的web服务器正在运行Linux。

为了安装使用组件对象模型所需的PHP扩展(php_com_dotnet,这可以访问COM类),您需要运行Windows Server,还需要在该Windows Server上安装Microsoft PowerPoint,以便以您尝试的方式操作PPT。