Topic "Problem with php scripting"

Author Message
Spike00

Guest


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 http://winscp.net/eng/docs/guide_automation_advanced#external_script_interpreters_php_perl_etc there was an error.

I put all those backslashes according to this: http://www.php.net/manual/en/function.system.php#68768

my global.txt contains this:

Code:
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?
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You should definitelly use winscp.com, not winscp.exe.
_________________
Martin Prikryl
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
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
Guest




Thank you Martin, it was that Embarassed
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License