php-windows Digest 25 Sep 2007 01:07:41 -0000 Issue 3335

Topics (messages 28496 through 28499):

Re: odbc_connect unknown error
        28496 by: John Mertic
        28497 by: Alexander Fradiani
        28498 by: John Mertic

SFTP connections via PHP
        28499 by: Cameron Just

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 ---
I'd check the following in order...

1) Does the user running the web process have access to the file using
the path provided?
2) Did you set the DSN as a System DSN?
3) Try using a DSN-less connection, namely:

$dsn = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" + $fullpathtodb;
$con = odbc_connect($dsn,$user,$pass) or die(odbc_error());

John

On 9/19/07, Alexander Fradiani <[EMAIL PROTECTED]> wrote:
>
> Hello!.
>
> I have a problem when trying to connect to an access database:
>
> $con = odbc_connect($dsn,$user,$pass) or die(odbc_error());
>
> the error message i get is just this:
> IM002
>
> the $dsn var only contains the name of a data source previously created from 
> the windows control panel.
> i already tested the $dsn making a connection with visual basic code and it 
> works fine.
> Also the user and pass are right. so i dont know what could be the problem.
>
> I am using PHP 5.2.4-win32. with apache 2.2.4.
>
> I really appreciate any help on this.
> Alexander
> _________________________________________________________________
> Invite your mail contacts to join your friends list with Windows Live Spaces. 
> It's easy!
> http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us


-- 
-- 
John Mertic                                        "Explaining a joke
is like dissecting a frog: you
[EMAIL PROTECTED]                              understand it better,
but the frog dies in the
                                                          process."

                      -Mark Twain

--- End Message ---
--- Begin Message ---
> 1) Does the user running the web process have access to the file using> the 
> path provided?> 2) Did you set the DSN as a System DSN?> 3) Try using a 
> DSN-less connection, namely:> > $dsn = "Driver={Microsoft Access Driver 
> (*.mdb)}; DBQ=" + $fullpathtodb;> $con = odbc_connect($dsn,$user,$pass) or 
> die(odbc_error());> > John
Ok, it worked fine using the extended connection string you wrote in the 
example.
I wonder if there is a way to connect to a remote database, what i'm doing now 
is upload the .mdb file to the server and use it as local, but it would be 
better connect to the remote system.
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us

--- End Message ---
--- Begin Message ---
You can if the user that runs the web server process has access to
that file then yes. Or you could set an ODBC bridge, but to be honest
it's much faster and easier ( depending upon the application's
requirements of course ) to export it to a SQLite or MySQL DB on the
webserver.

John

On 9/20/07, Alexander Fradiani <[EMAIL PROTECTED]> wrote:
>
>  > 1) Does the user running the web process have access to the file using
> > the path provided?
> > 2) Did you set the DSN as a System DSN?
> > 3) Try using a DSN-less connection, namely:
> >
> > $dsn = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" + $fullpathtodb;
> > $con = odbc_connect($dsn,$user,$pass) or die(odbc_error());
> >
> > John
>
>  Ok, it worked fine using the extended connection string you wrote in the
> example.
>  I wonder if there is a way to connect to a remote database, what i'm doing
> now is upload the .mdb file to the server and use it as local, but it would
> be better connect to the remote system.
>
> ________________________________
> Invite your mail contacts to join your friends list with Windows Live
> Spaces. It's easy! Try it!


-- 
-- 
John Mertic                                        "Explaining a joke
is like dissecting a frog: you
[EMAIL PROTECTED]                              understand it better,
but the frog dies in the
                                                          process."

                      -Mark Twain

--- End Message ---
--- Begin Message ---
Hi All,

Just wondering if anyone has had any success getting a connection working with PHP via SFTP.

I am running
Win 2003 Server
PHP Version 5.1.6
Win32 OpenSSL v0.9.8e Light is installed
PECL module for SSH2 is installed

The following code
-----------------------------
   // create connetion to remote server
   if (!$sftpConnection = ssh2_connect(DNCR_SERVERNAME, 22)) {
       echo 'ERROR: Server connection failed.' . "\n";
       exit;
   }

   // check fingerprint of remote server matches what we expect
$dncrFingerprint = ssh2_fingerprint($sftpConnection, SSH2_FINGERPRINT_MD5 | SSH2_FINGERPRINT_HEX);
   if ($dncrFingerprint != DNCR_FINGERPRINT && FALSE) {
       echo 'ERROR: Hostkey mismatch.' . "\n";
       exit;
   }

   // ensure that authentication methods allowed
$sshAcceptedAuthenticationMethods = ssh2_auth_none($sftpConnection,DNCR_USERNAME);
   echo "\n" . 'Accepted authentication methods:' . "\n";
for ($i = 0; $i < count($sshAcceptedAuthenticationMethods); $i++) echo $sshAcceptedAuthenticationMethods[$i] . "\n";
   echo "\n";

   $sshNegotiatedMethods = ssh2_methods_negotiated($sftpConnection);
echo 'Encryption keys were negotiated using: {' . $sshNegotiatedMethods['kex'] . '}' . "\n"; echo 'Server identified using an {' . $sshNegotiatedMethods['hostkey'] . '} with ';
   echo 'fingerprint: ' . ssh2_fingerprint($sftpConnection) . "\n";

   echo 'Client to Server packets will use methods:' . "\n";
echo 'Crypt: {' . $sshNegotiatedMethods['client_to_server']['crypt'] . '}' . "\n"; echo 'Comp: {' . $sshNegotiatedMethods['client_to_server']['comp'] . '}' . "\n"; echo 'MAC: {' . $sshNegotiatedMethods['client_to_server']['mac'] . '}' . "\n";

   echo 'Server to Client packets will use methods:' . "\n";
echo 'Crypt: {' . $sshNegotiatedMethods['server_to_client']['crypt'] . '}' . "\n"; echo 'Comp: {' . $sshNegotiatedMethods['server_to_client']['comp'] . '}' . "\n"; echo 'MAC: {' . $sshNegotiatedMethods['server_to_client']['mac'] . '}' . "\n";


if (!ssh2_auth_password($sftpConnection, DNCR_USERNAME , DNCR_PASSWORD)) {
       echo 'ERROR: Cannot authenticate to remote server.' . "\n";
       exit;
   }
-----------------------------

produces the following result
-----------------------------

Accepted authentication methods:
publickey
keyboard-interactive

Encryption keys were negotiated using: {diffie-hellman-group14-sha1}
Server identified using an {ssh-dss} with fingerprint: 
F4EE0910B0C6BA932908320145F87790
Client to Server packets will use methods:
Crypt: {aes256-cbc}
Comp: {none}
MAC: {hmac-sha1}
Server to Client packets will use methods:
Crypt: {aes256-cbc}
Comp: {none}
MAC: {hmac-sha1}

*Warning*:  ssh2_auth_password() [function.ssh2-auth-password 
<http://vesd.rd.cx/phoenix/function.ssh2-auth-password>]: Authentication failed 
for myusername using password in 
*c:\Inetpub\wwwroot\VESD\phoenix\composer-stage1-wash-file-submission.php* on line 
*67*

ERROR: Cannot authenticate to remote server.

-----------------------------

I can connect to this remote server via SFTP using Filezilla so there is no firewall issues.

I also did a bit of reading on the accepted authentication method of keyboard-interactive and it states that password should be allowed to be sent
http://www.ssh.com/support/documentation/online/ssh/winhelp/32/overview.html

Any help would be greatly appreciated.

Thankyou

--- End Message ---

Reply via email to