WebFaction
Community site: login faq

I was hoping for a PHP based SVN API like this one here (http://php.net/manual/en/book.svn.php)

It does look a bit experimental but it's on the PHP website. I'm wondering what would be required/recommended to make this work, or what alternatives there might be available (other than something like exec in PHP)

Thanks

EDITED: THE .htaccess CODE BELOW WORKS, BUT only if you change it to read "Action php53-cgi /php53.cgi" first!

asked 17 Aug '11, 19:08

Mick
1811
accept rate: 0%

edited 19 Aug '11, 03:42

I came across (eventually) a handy PEAR effort (http://pear.php.net/manual/en/package.tools.versioncontrol-svn.php) which does a good job of encapsulating the svn command.

The only hiccup is executing svn from within PHP generates some noise in the first line...

svn: Can't open file '/root/.subversion/servers': Permission denied

Found this (http://forum.webfaction.com/viewtopic.php?id=1564) but did not seem helpful.

I hacked the PEAR code to shift the error off the output array so that it would be legal XML. Assuming this remains very regular output wise it's probably livable. But I would feel better to do things right.

FYI: I don't get this error (as you guys probably well know) from the command line, logged in over SSH. The file being complained about does not seem to be necessary because the rest of the output is as it should be.

(18 Aug '11, 05:30) Mick

PS: Is there a way to switch to php53 for files under a given directory? Eg. with a .htaccess file? Thanks!

(18 Aug '11, 06:20) Mick

As for the bug it is difficult to say without actually running it what the issue could be. From the info in that old post the issue is who the script is running as, the 'apache' user vs your user and it simply may not work or would need its permissions or how it works with permissions altered. I do not see any solution that I would try that was not tried in that post.

As for php53 conversion yes it is possible,

Action /php53-cgi php53.cgi
AddHandler php53-cgi .php

You will also need a symbolic link,

$ ln -s /home/php-cgi/php53.cgi .

(18 Aug '11, 17:12) johns ♦♦

Is it appropriate that the apache user would get this error? Could someone maybe look into making the error go away for the apache user?

Running the svn command as apache in just about any way will probably reproduce the bug.

(18 Aug '11, 17:51) Mick

Hmmm, the php53 changes did not go well. Browsers download the files unprocessed after the changes.

I put the Action/AddHandler line at the top of the .htaccess file and added the symlink to the same directory.

(18 Aug '11, 18:06) Mick

Q: "Is it appropriate that the apache user would get this error? Could someone maybe look into making the error go away for the apache user?"

A: We can not research and debug 3rd party libraries for you, there is simply to many syntax errors and not enough time. We are happy to assist you with debugging them and answering any questions we can. To further research this we would need a way to reproduce the issue in real time step by step so we can see what is going on. You might want to submit a support ticket for this, or parse the information for public viewing here.

The same goes for the php53 issue as we would need to see the issue live.

(18 Aug '11, 19:45) johns ♦♦

Ok, but 'svn: Can't open file '/root/.subversion/servers': Permission denied' seems like it might be a config/setup thing vs. a bug. I did not setup the svn command as far as I know, so one of you guys must have.

I suppose I will have to submit a support ticket for php53 then...

(18 Aug '11, 21:33) Mick

FYI: The support ticket revealed that the .htaccess "Action" line above should've read "Action php53-cgi /php53.cgi" instead. I will edit a comment into the top post now...

(19 Aug '11, 03:41) Mick
showing 5 of 8 show 3 more comments

You could possibly install this with a PECL package. You would have to download and install PECL and the package,

# Create an install directory
mkdir ~/pecl_install
cd ~/pecl_install
# Download the last version of Imagick (as seen at http://pecl.php.net/package/svm)
wget http://pecl.php.net/get/svm-0.1.3.tgz
# Unpack and get inside the extracted dir
tar xzvf svm-0.1.3.tgz
cd svm-0.1.3
# Generate the configuration script
phpize53
# Configure for php53 and make
./configure --with-php-config=/usr/local/bin/php53-config
make
# Create a folder where the custom PHP extensions would live
mkdir ~/php53-exts
# Copy the compiled extension to the custom folder
cp modules/pecl_svn.so ~/php53-exts/
# (Optional) Link the default server extensions inside the new folder, so they are still accessible
ln -s /usr/local/lib/php53/extensions/no-debug-non-zts-20090626/* ~/php53-exts/

# Customize the php.ini file of the desired web application, so that it loads the new extension
# MAKE SURE to replace 'htdocs' with the specific application you are enabling this for
echo "extension_dir = $HOME/php53-exts" >> ~/webapps/htdocs/php.ini
echo "extension = pecl_svn.so" >> ~/webapps/htdocs/php.ini

The above code was modified from another module and is untested, but should in general work.

permanent link

answered 17 Aug '11, 21:15

johns ♦♦
5.2k211
accept rate: 22%

^Wow... from the looks of the PECL requirements it seemed like a long shot. I did not notice this reply even though it's 9hrs old. I expected an email notification I think.

I've added some comments to the top post, if I can refocus the Q&A at this point. Mainly I would like to be able to use php53 (DateTime) for this application, and I seem to have a pesky but nonfatal permissions problem.

Thanks again.

(18 Aug '11, 06:26) Mick
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×261
×74
×40
×20

question asked: 17 Aug '11, 19:08

question was seen: 4,969 times

last updated: 19 Aug '11, 03:42

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM