Forum Moderators: coopster
When I run svnlook from a php script, the pipe is empty. With the following code (when called from a browser) I can pipe it to a file but all it does is create an empty file.
$cmdstr = "svnlook tree /usr/local/svn/manuals > pipetest.txt";
$fp = popen( $cmdstr, "r" ); // open the output of command as a pipe
while( $buffer = fgetss ( $fp, 4096 ) ) {
echo "$buffer<br>";
echo"loop";
}
The odd thing is, I can log in as apache and run this script from the command line with no problem and I would have thought if it were a permission issue or something like that then it shouldn't have created the file?
If I remove the pipe to the file, it returns nothing. If I change $cmdstr to do a "find /usr/local/......" it works great whether I echo it back or write to a file.
Any thoughts? Resources?
Thanks,
Scott
I used phpinfo() to find out where apache had been installed and then found error_log with a recent timestamp. The message that appears to relate to this is:
"svn: Expected version '2' of repository; found version '3'"
I wonder why it generates an error here but not from the command line? Is this just that Apache is more sensitive to an error message being returned and cancels the process?
Is there a way to suppress it? -like with a big stick? I've been searching for hours and a little release would feel pretty good right about now...
Thanks
Scott
Turned out that an older version of svn had been installed on that machine at sometime in the past. I ran "which svnlook" and realized that it was running the wrong one. Apparently -according to a co-worker- it runs in a different enviroment when run from within a web page as opposed to running the same php file from the command line (even though logged in as "apache")?
For the time being it runs fine as long as I explicitly include the path to the newer version of svnlook.
Thanks again,
Scott