COM component Error in php 5
Posted: Mon Jan 11, 2010 7:33 am
Hi,
I am using a third party COM component in PHP. I have installed WAMP PHP 4.4.4 with Apache 2.0.59 on Windows XP SP2 and it runs perfectly fine on it.
Now I want to upgrade PHP and Apache versions on my server due to some security reasons. I have installed XAMPP with PHP 5.3 and Apache 5.2.12 and it gives me error. COM component is successfully created but gives error when passing parameter to function e.g. Connect(int value).
There are two methods to connect to the server:
-- Connect(integer value [branch]) => In this method, parameter is mandatory which is of integer type.
-- ConnectSpecific(integer value [branch], string value [IP], int value [port], int value
[timeout]) - Only first parameter is mandatory which is of integer type.
Following is the code:
As IP address, port and timeout parameters in the function ConnectSpecific() are optional. Only branch parameter is mandatory.
Above line gives error:
Fatal error: Uncaught exception 'com_exception' with message 'Parameter 0: Type mismatch. ' in C:\xampp\htdocs\newtest.php:17 Stack trace: #0 C:\xampp\htdocs\newtest.php(17): com->Connect(0) #1 {main} thrown in C:\xampp\htdocs\newtest.php on line 17
Please see the Images for the actual error message.
Thanks.
I am using a third party COM component in PHP. I have installed WAMP PHP 4.4.4 with Apache 2.0.59 on Windows XP SP2 and it runs perfectly fine on it.
Now I want to upgrade PHP and Apache versions on my server due to some security reasons. I have installed XAMPP with PHP 5.3 and Apache 5.2.12 and it gives me error. COM component is successfully created but gives error when passing parameter to function e.g. Connect(int value).
There are two methods to connect to the server:
-- Connect(integer value [branch]) => In this method, parameter is mandatory which is of integer type.
-- ConnectSpecific(integer value [branch], string value [IP], int value [port], int value
[timeout]) - Only first parameter is mandatory which is of integer type.
Following is the code:
Code: Select all
<?php
$oid = 5;
$input = "";
$branch = 0;
$ip_address = "151.171.1.254";
$port = 3011;
$timout = 60;
$Link = new COM("object.Name");
$result = $Link->ConnectSpecific($branch ,$ip_address, $port, $timout); // error line
//$result = $Link->Connect($branch); // error line
if($result) {
$response = "";
$sendResult = $Link->Send($input, $response);
if($sendResult) {
echo "success";
}
else {
echo "Unable to send file...";
}
$Link->Disconnect();
}
else {
echo "Unable to connect with Server";
}
?>
Code: Select all
$result = $Link->Connect($branch); // Line # 17
Fatal error: Uncaught exception 'com_exception' with message 'Parameter 0: Type mismatch. ' in C:\xampp\htdocs\newtest.php:17 Stack trace: #0 C:\xampp\htdocs\newtest.php(17): com->Connect(0) #1 {main} thrown in C:\xampp\htdocs\newtest.php on line 17
Please see the Images for the actual error message.
Thanks.