php-windows Digest 5 Dec 2007 14:09:29 -0000 Issue 3377
Topics (messages 28611 through 28620):
Re: COM - Problem with Dates
28611 by: Oliver Espeter
28612 by: Elizabeth Smith
28614 by: Oliver Espeter
Re: crypt() with decription
28613 by: Oliver Espeter
Errors with urlencode and gzcompress
28615 by: James Crow
28616 by: Bill Bolte
28617 by: James Crow
28619 by: Viola Holownia
Re: PHP and MySQL Configuration on my WinXP Pro machine
28618 by: Jacob Kruger
28620 by: Bill Bolte
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi,
I have still the same problem. Because I didn't find a solution, I am
aktualy writing a php extension that wrapps around the needed functions of
the third-party com-sdk.
My plan:
- Connect to the third-party lib throuh COM direcly from my
php-source-files.
- Using all running third-party functions direcly from my php-source-files
without my extension.
- Wrapp the functions "ArcValue" and "PlotValues" with an self-made
extension, so that I can call the specified functions with C.
- Call this self-made functions from my php-source-code (as first parameter
I'll set the reference to the PIPoint)
An code-example in php could be:
1 <?php
2 $comObjPi = new COM('PISDK.PISDK');
3 $server = $comObjPi->Servers->Item("123.123.123.123");
4 $server->Open("123.123.123.123;UID=foo;pwd=bar");
5 $point = $server->PIPoints("SINUSOID");
6 com_load_typelib('PISDK.PISDK');
7 $value = myArcValueFunction($point, mktime(), rtBefore);
8 ?>
But now my problem:
Writing an php extension is not that problem. Including COM-Functions isn't
one too. But using COM from an php extension is new for me. Because I have
to use nmake (or haven't I?) I can't use the "#import' statements:
#import "pisdkcommon.dll" no_namespace
#import "piTimeServer.dll" no_namespace
#import "pisdk.dll" no_namespace
And when I didn't import that third-Party-dlls then nmake throws
compiler-errors because normaly I have to tell PHP that the first parameter
from myArcValueFunction is from type PIPointPtr (defined in one of the
DLLs).
Any suggestions?
--
Mit freundlichen Grüßen / Best Regards
Oliver Espeter
""Oliver Espeter"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi,
> I have problems fetching data from an special database over a com-based
> sdk. With VisualBasic it's not a problem,
> but the same code doesn't work with php.
>
> First some Data:
> - The database system holds high compressed industrial data and is called
> OSI-PI. The system itself is under a
> comercial license (OSI Soft Inc.).
> - The distributor gave us a sdk - fully OO.
> - The sdk has to be integrated over COM.
> - My 1. testsystem: Windows 2000 Professional Version 5.00.2195 with php
> 5.2.2
> - My 2. testsystem: Windows 2003 Server with php 5.2.4
>
> Here a code-sniplet from me that work:
> 1 <?php
> 2 $comObjPi = new COM('PISDK.PISDK');
> 3 $server = $comObjPi->Servers->Item("123.123.123.123");
> 4 $server->Open("123.123.123.123;UID=foo;pwd=bar");
> 5 $point = $server->PIPoints("SINUSOID");
> 6 echo "\n".$point->Data->SnapShot()->Value."\n";
> 7 echo "\n".$point->Data->SnapShot()->TimeStamp."\n";
> 8 ?>
>
> Line 2 makes an object from the sdk. Line 3 and 4 builds up the connection
> to the server. Line 5 connects to
> an datapoint (PI-Point/Sinosoid is a testpoint). Line 6 and 7 receive the
> last value and the last time that are stored
> in the point. Everything WORKS FINE.
>
> But when we use some other functions of the sdk, php throws some
> exceptions:
>
> 9 com_load_typelib('PISDK.PISDK');
> 10 echo "\nTest 1:\n";
> 11 try{
> 12 $value = $point->Data->ArcValue(new Variant(mktime(), VT_R8),
> rtBefore);
> 13 }
> 14 catch(Exception $e){
> 15 print("\nException Versuch 1 ".$e->getMessage()." TraceString:
> ".$e->getTraceAsString());
> 16 }
> 17
> 18 echo "\nTest 2:\n";
> 19 try{
> 20 $value =
> $point->Data->ArcValue(variant_date_from_timestamp(mktime()), rtBefore);
> 21 }
> 22 catch(Exception $e){
> 23 print("\nException Versuch 2 ".$e->getMessage()." TraceString:
> ".$e->getTraceAsString());
> 24 }
> 25
> 26 $server->Close();
> 27 ?>
>
> Line 12/20: The function ArcValue is designed for calling archived values
> from a pi-point. It needs two values.
> First the date/time as Long, Int, String..., nearly each format. The
> second value is a constant. We loaded all
> of them in Line 9. We tested all types of variant for the first value, but
> each time it throws the following exception:
>
> ---
> Test 1:
> Exception Test 1 Parameter 0: Typkonflikt. //Type-Mismatch in the english
> version
> TraceString: #0 C:\php_pi\pitest.php(12):
> variant->ArcValue(Object(variant), 6)
> #1 {main}
> Test 2:
> Exception Test 2 Parameter 0: Typkonflikt.
> TraceString: #0 C:\php_pi\pitest.php(20):
> variant->ArcValue(Object(variant), 6)
> #1 {main}
> ----
>
> We tested other functions from the sdk. But each time we tried we lose.
> :-/ Fololowing an example written in
> VisualBasic that works fine:
>
> Imports pisdk
> Public Class Form1
> Private Sub Form1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Click
> Dim MySdk As New PISDK.PISDK
> Dim pt As PIPoint
> Dim v As PIValues
> pt = MySdk.Servers.DefaultServer.PIPoints("sinusoid")
> v = pt.Data.PlotValues("1-Jan-07", "*", 1000)
> MsgBox(v.Count & " Elements")
> End Sub
> End Class
>
> It receives all datarows for the point "sinusoid" since first Jan and
> counts them. This example works with
> VisualBasic but it didn't work on php.
>
> Some programmers of OSI-Soft said that all functions takes objects as
> parameter so the type-mismatch is a
> problem in php. Because of the working VB code I think they are right.
>
> Has anyone a hint for me or a likewise problem with an other
> sdk/application?
>
> Regards
> Oliver
--- End Message ---
--- Begin Message ---
Oliver Espeter wrote:
Hi,
I have still the same problem. Because I didn't find a solution, I am
aktualy writing a php extension that wrapps around the needed functions of
the third-party com-sdk.
My plan:
- Connect to the third-party lib throuh COM direcly from my
php-source-files.
- Using all running third-party functions direcly from my php-source-files
without my extension.
- Wrapp the functions "ArcValue" and "PlotValues" with an self-made
extension, so that I can call the specified functions with C.
- Call this self-made functions from my php-source-code (as first parameter
I'll set the reference to the PIPoint)
An code-example in php could be:
1 <?php
2 $comObjPi = new COM('PISDK.PISDK');
3 $server = $comObjPi->Servers->Item("123.123.123.123");
4 $server->Open("123.123.123.123;UID=foo;pwd=bar");
5 $point = $server->PIPoints("SINUSOID");
6 com_load_typelib('PISDK.PISDK');
7 $value = myArcValueFunction($point, mktime(), rtBefore);
8 ?>
But now my problem:
Writing an php extension is not that problem. Including COM-Functions isn't
one too. But using COM from an php extension is new for me. Because I have
to use nmake (or haven't I?) I can't use the "#import' statements:
#import "pisdkcommon.dll" no_namespace
#import "piTimeServer.dll" no_namespace
#import "pisdk.dll" no_namespace
And when I didn't import that third-Party-dlls then nmake throws
compiler-errors because normaly I have to tell PHP that the first parameter
from myArcValueFunction is from type PIPointPtr (defined in one of the
DLLs).
Any suggestions?
Have you looked at some of the extensions in pecl? I would suggest
linking against the dlls you intend to use and take a gander at the php
extension build system for how to manage that - try the pecl.dev mailing
list for help in the C end of things
--- End Message ---
--- Begin Message ---
Thanks for the very (!) fast answer. I'll consult that mail-list as you
recoment.
--
Mit freundlichen Grüßen / Best Regards
Oliver Espeter
---------------------------------
GravityShock- Kraus & Espeter GbR
Tel.: +49 (2301) 9 18 39 33
Fax : +49 (2301) 91 28 96
www : www.GravityShock.biz
"Elizabeth Smith" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Oliver Espeter wrote:
>> Hi,
>> I have still the same problem. Because I didn't find a solution, I am
>> aktualy writing a php extension that wrapps around the needed functions
>> of the third-party com-sdk.
>>
>> My plan:
>> - Connect to the third-party lib throuh COM direcly from my
>> php-source-files.
>> - Using all running third-party functions direcly from my
>> php-source-files without my extension.
>> - Wrapp the functions "ArcValue" and "PlotValues" with an self-made
>> extension, so that I can call the specified functions with C.
>> - Call this self-made functions from my php-source-code (as first
>> parameter I'll set the reference to the PIPoint)
>>
>> An code-example in php could be:
>> 1 <?php
>> 2 $comObjPi = new COM('PISDK.PISDK');
>> 3 $server = $comObjPi->Servers->Item("123.123.123.123");
>> 4 $server->Open("123.123.123.123;UID=foo;pwd=bar");
>> 5 $point = $server->PIPoints("SINUSOID");
>> 6 com_load_typelib('PISDK.PISDK');
>> 7 $value = myArcValueFunction($point, mktime(), rtBefore);
>> 8 ?>
>>
>> But now my problem:
>> Writing an php extension is not that problem. Including COM-Functions
>> isn't one too. But using COM from an php extension is new for me. Because
>> I have to use nmake (or haven't I?) I can't use the "#import' statements:
>>
>> #import "pisdkcommon.dll" no_namespace
>> #import "piTimeServer.dll" no_namespace
>> #import "pisdk.dll" no_namespace
>>
>> And when I didn't import that third-Party-dlls then nmake throws
>> compiler-errors because normaly I have to tell PHP that the first
>> parameter from myArcValueFunction is from type PIPointPtr (defined in one
>> of the DLLs).
>>
>> Any suggestions?
>>
>
> Have you looked at some of the extensions in pecl? I would suggest
> linking against the dlls you intend to use and take a gander at the php
> extension build system for how to manage that - try the pecl.dev mailing
> list for help in the C end of things
--- End Message ---
--- Begin Message ---
I can only agree Bill and Elizabeth.
@Nishantha:
Do you only need a password-recovery function for registered users? Then
simply create an random-string, save it in an extra column of your Data
Stock and give it to the user. Also you can - as Elizabeth wrote - use an
two-way-decryption and give the user the decrypted version. But that'll open
a huge securityhole in your application. Fact: Users will use the same
password in different systems. So first: Can and will the User trust you?
Second: Can you trust the people that can look into the database/file/stock?
Third: Can you by 100% trust your sourcecode, so that never a third party
hacks your system and decryps all passwords?
I would ever prefer an one-way-function when the project afford it.
--
Mit freundlichen Grüßen / Best Regards
Oliver Espeter
""Bill Bolte"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
There isn't a way to un-encrypt it, it's a one-way encryption
(http://www.php.net/manual/en/function.crypt.php). The user will have to
recreate their password.
-----Original Message-----
From: Nishantha Pradeep [mailto:[EMAIL PROTECTED]
Sent: Monday, December 03, 2007 9:15 PM
To: php
Subject: [PHP-WIN] crypt() with decription
I used php crypt() function to encript password (as a simple encryption)
but
how I decrypt that encrypted password because I want to send the
password to
the user when it requested.
--- End Message ---
--- Begin Message ---
Hello all,
I am having some trouble figuring out how to pass data to a remote PHP
script.
Here is the scenario:
I have several Windows boxes running Apache 2 and PHP 4. PHP5 is not an
option because of some Zend Encoded scripts that we purchased. I need to
pass data from one script to a remote script. The local script has an
array that is serialized. Then the serialized string is then double
urlencoded. A single urlencode does not work correctly on PHP4/Win32.
The serialized and urlencoded string is then passed in the request to a
remote script: http://192.168.1.2?data=<serialized string>
This process works fine for small amounts of data. If the URL is below a
certain limit (maybe 1024 characters, have not yet found the exact size
limit) this works fine.
I now have a need to pass more data to the remote script. I have tried
to do
$temp = array ('lots of data...');
$temp1 = serialize($temp);
$temp2 = gzcompress($temp1); //compress our string first to save space
$temp3 = urlencode($temp2);
$data = urlencode($temp3);
http://192.168.1.1/?data=$data
Sometimes this works and sometimes not. I have not yet been able to
figure out why this sometimes fails.
Can anyone tell me why this works sometimes and others not? Or can
someone suggest a better way of passing data to a remote script.
Thanks,
James
--- End Message ---
--- Begin Message ---
Use Curl and pass XML...
-----Original Message-----
From: James Crow [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 04, 2007 1:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Errors with urlencode and gzcompress
Hello all,
I am having some trouble figuring out how to pass data to a remote PHP
script.
Here is the scenario:
I have several Windows boxes running Apache 2 and PHP 4. PHP5 is not an
option because of some Zend Encoded scripts that we purchased. I need to
pass data from one script to a remote script. The local script has an
array that is serialized. Then the serialized string is then double
urlencoded. A single urlencode does not work correctly on PHP4/Win32.
The serialized and urlencoded string is then passed in the request to a
remote script: http://192.168.1.2?data=<serialized string>
This process works fine for small amounts of data. If the URL is below a
certain limit (maybe 1024 characters, have not yet found the exact size
limit) this works fine.
I now have a need to pass more data to the remote script. I have tried
to do
$temp = array ('lots of data...');
$temp1 = serialize($temp);
$temp2 = gzcompress($temp1); //compress our string first to save space
$temp3 = urlencode($temp2);
$data = urlencode($temp3);
http://192.168.1.1/?data=$data
Sometimes this works and sometimes not. I have not yet been able to
figure out why this sometimes fails.
Can anyone tell me why this works sometimes and others not? Or can
someone suggest a better way of passing data to a remote script.
Thanks,
James
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Curl is an option, but I would rather not add an extension to 100 remote
servers if possible. I was hoping to find a PHP native way.
Thanks,
James
On Tue, 2007-12-04 at 13:29 -0600, Bill Bolte wrote:
> Use Curl and pass XML...
>
> -----Original Message-----
> From: James Crow [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 04, 2007 1:15 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Errors with urlencode and gzcompress
>
> Hello all,
>
> I am having some trouble figuring out how to pass data to a remote PHP
> script.
>
> Here is the scenario:
> I have several Windows boxes running Apache 2 and PHP 4. PHP5 is not an
> option because of some Zend Encoded scripts that we purchased. I need to
> pass data from one script to a remote script. The local script has an
> array that is serialized. Then the serialized string is then double
> urlencoded. A single urlencode does not work correctly on PHP4/Win32.
> The serialized and urlencoded string is then passed in the request to a
> remote script: http://192.168.1.2?data=<serialized string>
> This process works fine for small amounts of data. If the URL is below a
> certain limit (maybe 1024 characters, have not yet found the exact size
> limit) this works fine.
>
> I now have a need to pass more data to the remote script. I have tried
> to do
> $temp = array ('lots of data...');
> $temp1 = serialize($temp);
> $temp2 = gzcompress($temp1); //compress our string first to save space
> $temp3 = urlencode($temp2);
> $data = urlencode($temp3);
> http://192.168.1.1/?data=$data
>
> Sometimes this works and sometimes not. I have not yet been able to
> figure out why this sometimes fails.
>
> Can anyone tell me why this works sometimes and others not? Or can
> someone suggest a better way of passing data to a remote script.
>
> Thanks,
> James
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Have you ever try JSON for data transfer?
http://json.org/
hope that helps.
You will also nend to have json.dll extension install on your php.
all the best,
Viola
On Dec 4, 2007 2:14 PM, James Crow <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I am having some trouble figuring out how to pass data to a remote PHP
> script.
>
> Here is the scenario:
> I have several Windows boxes running Apache 2 and PHP 4. PHP5 is not an
> option because of some Zend Encoded scripts that we purchased. I need to
> pass data from one script to a remote script. The local script has an
> array that is serialized. Then the serialized string is then double
> urlencoded. A single urlencode does not work correctly on PHP4/Win32.
> The serialized and urlencoded string is then passed in the request to a
> remote script: http://192.168.1.2?data=<serialized string>
> This process works fine for small amounts of data. If the URL is below a
> certain limit (maybe 1024 characters, have not yet found the exact size
> limit) this works fine.
>
> I now have a need to pass more data to the remote script. I have tried
> to do
> $temp = array ('lots of data...');
> $temp1 = serialize($temp);
> $temp2 = gzcompress($temp1); //compress our string first to save space
> $temp3 = urlencode($temp2);
> $data = urlencode($temp3);
> http://192.168.1.1/?data=$data
>
> Sometimes this works and sometimes not. I have not yet been able to
> figure out why this sometimes fails.
>
> Can anyone tell me why this works sometimes and others not? Or can
> someone suggest a better way of passing data to a remote script.
>
> Thanks,
> James
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
I'd actually thought this list was relatively inactive up until the various
replies to all the other messages today, so I thought I'd send a 'reminder'
relating to my specific problem (see below).
If you guys are all using PHP on a Windows machine, it's a bit strange that
I'm the only one who's run into this problem, so hopefully one or two of you
can tell me what to look at/into.
Thanks in advance
Jacob Kruger
Blind Biker
Skype: BlindZA
'...Fate had broken his body, but not his spirit...'
----- Original Message -----
Ok. Had both components installed/configured on my machine, but seem to be
experiencing a 'new' problem.
Been starting up with this stuff again now, and after wondering why no MySQL
related code would produce a result, I went into my php.ini file and made
sure it would in fact generate/display all errors, and 'suddenly' I'm
getting not only popups whenever any PHP page starts to load moaning about
'invalid memory access' linked to actually loading the relevant DLL files
for the database access, and the obvious errors related to not being able to
execute any code related to mysql_ objects/functions rendered in the actual
output, but I can't even
execute normal code like just using something like echo "hello world";
It was working after the last 'move' to a different folder (c:\php and
c:\zMysql), but even after looking over various forums, searching for
relevant info using google, and making sure that IUSR_MachnieName had full
access to the various folders where the .DLL files where located, it still
won't work.
FWIW, I have Windows XP Pro, IIS, PHP 5.2.3, and MySQL 5.0.41 installed, and
followed all guidelines I could find/get for configuration etc., and the
paths mentioned in those popup dialogues mentioning these problems do in
fact refer to the correct file paths, and file names, and FWIW, it's not
just the MySQL DLL it can't load, since that dialogue pops up around 5 times
mentioning all 5 of the add-ins I chose during the actual install of PHP
etc.
I also have both the c:\php and c:\php\ext folders in the path environment
variable, at the front of that string.
While I would like to get this stuff on track, I'm wondering if its worth it
at all...
(maybe I should just 'dump' my Windows workstation, and install that Ubuntu
CD I have - LOL!)
Anyway, any suggestions?
--- End Message ---
--- Begin Message ---
I haven't had that experience and have used PHP with both IIS and Apache
on WinXP Pro. Have you tried re-installing though? Is there a reason
you're using IIS rather than Apache?
-----Original Message-----
From: Jacob Kruger [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 04, 2007 2:35 PM
To: [EMAIL PROTECTED]
Subject: Fw: [PHP-WIN] PHP and MySQL Configuration on my WinXP Pro
machine
I'd actually thought this list was relatively inactive up until the
various
replies to all the other messages today, so I thought I'd send a
'reminder'
relating to my specific problem (see below).
If you guys are all using PHP on a Windows machine, it's a bit strange
that
I'm the only one who's run into this problem, so hopefully one or two of
you
can tell me what to look at/into.
Thanks in advance
Jacob Kruger
Blind Biker
Skype: BlindZA
'...Fate had broken his body, but not his spirit...'
----- Original Message -----
Ok. Had both components installed/configured on my machine, but seem to
be
experiencing a 'new' problem.
Been starting up with this stuff again now, and after wondering why no
MySQL
related code would produce a result, I went into my php.ini file and
made
sure it would in fact generate/display all errors, and 'suddenly' I'm
getting not only popups whenever any PHP page starts to load moaning
about
'invalid memory access' linked to actually loading the relevant DLL
files
for the database access, and the obvious errors related to not being
able to
execute any code related to mysql_ objects/functions rendered in the
actual
output, but I can't even
execute normal code like just using something like echo "hello world";
It was working after the last 'move' to a different folder (c:\php and
c:\zMysql), but even after looking over various forums, searching for
relevant info using google, and making sure that IUSR_MachnieName had
full
access to the various folders where the .DLL files where located, it
still
won't work.
FWIW, I have Windows XP Pro, IIS, PHP 5.2.3, and MySQL 5.0.41 installed,
and
followed all guidelines I could find/get for configuration etc., and the
paths mentioned in those popup dialogues mentioning these problems do in
fact refer to the correct file paths, and file names, and FWIW, it's not
just the MySQL DLL it can't load, since that dialogue pops up around 5
times
mentioning all 5 of the add-ins I chose during the actual install of PHP
etc.
I also have both the c:\php and c:\php\ext folders in the path
environment
variable, at the front of that string.
While I would like to get this stuff on track, I'm wondering if its
worth it
at all...
(maybe I should just 'dump' my Windows workstation, and install that
Ubuntu
CD I have - LOL!)
Anyway, any suggestions?
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---