Re: IIS metabase control, COM/DCOM problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is an extension in PECL (iisfunc) that hnadles this directly. It
works with both PHP4 and PHP5

- Frank

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

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux