Problem with php scripting

Advertisement

Spike00
Guest

Problem with php scripting

Hello, I wrote a php script to synchronize local dir with remote dir. The local dir is on a pc with xampp installed, so php is available just from localhost with the browser.

Environment is windows seven.

I'm quite sure that it was working, but unfortunately I had to stop the development for many days and now when I came back to it, it doesn't work.

Here is where it blocks:

system ("\"C:\\Program Files (x86)\\WinSCP\\WinSCP.exe\" /script=C:\mydir\Script\global.txt /log=C:\primarmi\Log\global_log.txt", $exitcode);

It returns 1 for exitcode, so according to https://winscp.net/eng/docs/guide_automation_advanced#external there was an error.

I put all those backslashes according to this: https://secure.php.net/manual/en/function.system.php

my global.txt contains this:

option batch abort
option confirm off
open ftp://user:pass@host
synchronize local mylocalpath remotepath
exit    

Tried to enable loggin, with no luck (or at least, nothing was logged. Is it possible that winscp neither started?)

Any hint on what to do?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: Problem with php scripting

You should definitelly use winscp.com, not winscp.exe.
_________________
Martin Prikryl

Reply with quote

Spike00
Guest

Thank you Martin,
Now I obtain this error message:

Cannot open file C:\mydir\Script

without the filename totale.txt

I searched the forum, but didn't find another with the same problem, only a user who had encoding problem. About encoding, I use geany as text editor and my file is encoded with UTF-8

I'm sure the path is correct (just to avoid mismatches I copied the path from the error message and pasted on window and it was ok).

I'm using Version 4.3.7 Build 1679

Any hint?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

You need to escape the backslashes too, just as you did with path to WinSCP
system ("\"C:\\Program Files (x86)\\WinSCP\\WinSCP.exe\" /script=C:\\mydir\\Script\\global.txt /log=C:\\primarmi\\Log\\global_log.txt", $exitcode);
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum