I'm trying to build a few PHP scripts to administer my IIS server, and I
have a problem/difference in output in the COM support from PHP 4.3.4 to
php 5b3.

I'm running php 4.3.4 and php 5beta3, both from command line, with full
administrative priveleges on a win2k server/IIS (and if important, over
terminal services).

If anybody has an idea why the difference in output is (change in the
functions? bug?), I'd appreciate quite a bit.

Output is below, with the sample code. Output has been modified only to
not give away IP address/hostname information.

Thanks in advance,
Andrew Séguin

----------------------------
-------PHP 4 Output---------
C:\php4>php -c c:\winnt\php.ini iis.class.php
Content-type: text/html
X-Powered-By: PHP/4.3.4

Array
(
    [0] => Array
        (
            [name] => 1
            [ServerComment] => XXXXXXX
            [bindings] => Array
                (
                    [0] => Array
                        (
                            [hostheader] => xxxxxxxxxxxxxxxxxxxxxxxxx
                            [port] => yy
                            [ip] => zzz.zzz.zzz.zzz
                        )

                )

        )
....



----------------------------
-------PHP 5 Output---------
C:\php4>copy iis.class.php ..\php5
C:\php4>cd ..\php5
C:\php5>php -c c:\winnt\php.ini iis.class.php
Content-type: text/html
X-Powered-By: PHP/5.0.0b3

<br />
<b>Fatal error</b>:  Uncaught exception 'exception' with message 'Unknown
except
ion' in C:\php5\iis.class.php:34
Stack trace:
#0 C:\php5\iis.class.php(112): iis::getSites()
#1 {main}
  thrown in <b>C:\php5\iis.class.php</b> on line <b>34</b><br />





------------------------------
-------Relevant code----------
--(line numbers in comments)--

<?php


class iis {
//...
/*30:*/ function getSites() {
                $iis = new COM("IIS://localhost/w3svc");
                $retarr = array();

/*34:*/         while( $obj = $iis->Next() ) {

                        if ($obj->Class == 'IIsWebServer') {
                                $server = array();

                                $site = new COM("IIS://Localhost/w3svc/".$obj->Name);
                                $server['name'] = $obj->Name;

                                $server['ServerComment'] = $site->ServerComment;
                                $bindings = $site->ServerBindings;

                                foreach($bindings as $binding) {

                                        list($b['ip'], $b['port'], $b['hostheader']) = 
explode(':', $binding);
                                        $server['bindings'][] = $b;

                                }

                                unset($site);

                                $retarr[] = $server;
                        }
                }
                unset($iis);

                return $retarr;
        }
//...

}

//echo("Max ID: " . iis::getNewSiteID() );
/*112*/print_r( iis::getSites() );
?>

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to