COM good on NT but fail on 2003?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rxsid
Forum Commoner
Posts: 82
Joined: Thu Aug 29, 2002 12:04 am

COM good on NT but fail on 2003?

Post by rxsid »

Hi all,

I currently have php 4.3.10 loaded on a windows 2003 server running apache 2.0.52. PHP and the web server work fine. I've got the code (that used to work on an old NT box running IIS and an earlier version of PHP...I think 4.1 or 4.2??)

Code: Select all

//.....code

$excel = new COM("Excel.Application") or Die ("Did not connect");

//Open the workbook that we want to use.
$book = $excel->Application->Workbooks->Open($reportPath.$rptName);

//....more code
Again...that used to work on NT, but now I can't get it to work on 2003. I believe the issue lies with the new COM() line, but it doesn't print out the or die statement.

I've followed the article on this site (which is how I got this Excel COM function to work with NT in the first place:
http://www.phpbuilder.net/columns/venkatesan20030501.php3
but perhaps this doesn't apply to the new win 2003 server?
I have the appropriate IUSR_MACHINE_Name user with Excel COM launch, etc. permissions.

Any ideas? :idea:
Thanks.

EDIT:
some more info...

when i run this script...nothing happens. at least that i can see. I look in the O/S event logs, nothing shows up there related to this. I look in the apache logs...nothing on this.

This script was run via the cmd line on the NT box (& should be run by cmd line on the 2003 box as well).

When I run the script (C:\somedir>theScript.php)...it pauses for about 2 seconds then just returns to the command line. I've got the php.ini file set to display all errors turned on. still, nothing is displayed in the cmd window.

P.S. I know php runs from the cmd line because i have other php scripts that run that way no problem.
rxsid
Forum Commoner
Posts: 82
Joined: Thu Aug 29, 2002 12:04 am

Post by rxsid »

an example of another attempt to trap an error and what's going on.

parse errror:

the code:

Code: Select all

<?
//******************************
//Create the spreadsheet object.
//******************************

$basePath = "F:\\_jobs\\reports\\adhoc\\SomeReportDir\\";
$reportPath = $basePath."report\\SomeReport.xls";

$excel = new COM("Excel.Application") or Die ("Did not connect");
if ($excel !=== FALSE) {  //This is the error line?!?!  I even tried "FALSE".
  print "Testing output.\n";
  print $excel;
} else {
  print "Error";
  die();
}

$book = $excel->Application->Workbooks->Open($reportPath.$rptName);

?>
F:\_jobs\reports\scripts>excel.php
PHP Parse error: parse error in F:\_jobs\reports\scripts\excel.php on line 10
Content-type: text/html

<br />
<b>Parse error</b>: parse error in <b>F:\_jobs\reports\scripts\excel.php</b> on
line <b>10</b><br />

F:\_jobs\reports\scripts>
...any ideas?
rxsid
Forum Commoner
Posts: 82
Joined: Thu Aug 29, 2002 12:04 am

Post by rxsid »

...anyone?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

!=== (three equals) is not an operator. !== (two equals) is. Maybe this is the problem?
rxsid
Forum Commoner
Posts: 82
Joined: Thu Aug 29, 2002 12:04 am

Post by rxsid »

thanks for the reply.

no, that's not the issue because the issue existed before i tried to trap the error with that bit of code. so, at this point, using the info from the original post, i'm not able to create the com object on the new box. strange.
Post Reply