0

If the code like this,it's ok

header("Cache-Control:no-cache,must-revalidate");
$handle = popen('svn --version','r'); 
$read = stream_get_contents($handle);
echo "<pre>";
printf($read);
echo "</pre>"; 
pclose($handle);

that's OK. output:

svn, version 1.6.11 (r934486) compiled Apr 11 2013, 16:13:51

Copyright (C) 2000-2009 CollabNet. Subversion is open source software,
see http://subversion.tigris.org/ This product includes software
developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

ra_neon : Module for accessing a repository via WebDAV protocol using Neon.

handles 'http' scheme
handles 'https' scheme
ra_svn : Module for accessing a repository using the svn network protocol.

with Cyrus SASL authentication
handles 'svn' scheme
ra_local : Module for accessing a repository on local disk.

handles 'file' scheme

but when I change the second line code to this:

$handle = popen('svn up --username zmk --password 123456 /home/wwwroot/test/','r');

it doesn't work. output nothing
If I run the 2nd line on the command line,the result is like this,it's OK: At revision 17.
I know the problem was caused by the permission on linux.
Who has the experience in this field?
give me a demo link,thanks in advance.

ZhouMengkang
  • 193
  • 8

2 Answers2

0

I see username param misspelled: userNMAe. May be that's the reason? Any way you could try popen('svn up --usernmae zmk --password 123456 /home/wwwroot/test/ 2>&1','r'); to see errors

Maximus
  • 159
  • 6
  • Change it to popen('svn up --usernmae zmk --password 123456 /home/wwwroot/test/ 2>&1','r'); AND change usernmae to username. It should make the thing – Maximus Feb 19 '14 at 05:17
  • If I changed the path to `'/home/wwwroot/test2'` ,it will output `Skipped '/home/wwwroot/test2'`.but if I write the right path,it would output nothing – ZhouMengkang Feb 19 '14 at 05:17
  • `popen('svn up --username zmk --password 123456 /home/wwwroot/test/ 2>&1','r');`the window can't be open. it's always being loading~ – ZhouMengkang Feb 19 '14 at 05:24
  • and I `svn up ./` in the command line, the svn working copy has been locked – ZhouMengkang Feb 19 '14 at 05:26
  • Can you look up my answer – ZhouMengkang Feb 19 '14 at 06:06
  • Well, it seems like your popen thing works ) but there is some svn issue. Maybe this topic http://stackoverflow.com/questions/3824513/svn-encrypted-password-store can help you. – Maximus Feb 19 '14 at 06:52
0

I have changed the code to this:

error_reporting(E_ALL);
$handle = popen('svn up --username zmk --password 123456 /home/wwwroot/test/ 2>&1','r'); 
echo "'$handle'; " . gettype($handle) . "\n";
$read = fread($handle, 2096);
echo $read;
pclose($handle);

I get it from @Max Yerissov and the php manual http://www.php.net/popen

In this situation,the output is:

'Resource id #1'; resource

-----------------------------------------------------------------------
ATTENTION!  Your password for authentication realm:

   <svn://XXX.XXX.XXX.XXX:3690> XXXXX-a464-4fc8-9f54-XXXXXX

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/www/.subversion/servers'.
-----------------------------------------------------------------------

then,I have modified the /home/www/.subversion/servers like this: https://wiki.lib.umn.edu/Subversion/ClientConfiguration.html

[global]
store-passwords = yes
store-plaintext-passwords = no

what's the most important is I have copied the code from the php manual.So I can catch the bug.

enter image description here

ZhouMengkang
  • 193
  • 8