How to execute php directly in svn

90 4

I want to direct access to the content in the version library and just like the access directory, which can automatically access the image.

The svn module is loaded in apache and passed.

DAV svn 

Open http access to svn. But php will be opened directly in http://localhost/svn ( see content ) and the picture can't be opened ( blank ).

2 Answers

50 4

Apache 's svn module can only provide the svn preview function, which is unable to execute the file directly. Because svn isn't stored on the server, it's stored in a certain format in a certain format. The svn module is used to parse this format.

If you want to preview the effect immediately after the svn commit, you can use the svn hook functionality, called svn hook, which allows you to.

First create a web directory on the server that you want to ask for later, such as this ( permission issue ).


In apache, configure the php runtime environment for this directory to ensure that it can be accessed.
Check out for a code to this directory ( which replaces the url of svn )

svn co http://my-svn-host/my-svn-path/wwwroot/svn-preview/--username=my-svn-username

Now we've the latest version of the code and can access it. And then to solve the problem of automatic synchronization. Find the repos directory of svn, look at your example, it seems to be /Users/mike/opt/svn.


You can see that there are a lot of the hook template files ( at the end of the tmpl, you just need to remove the extension, you can take effect ). And we need to be, so find post-commit.tmpl, copy him a copy.

cp post-commit.tmpl post-commit
chmod +x post-commit
vim post-commit

It's time to open the hook file, and there's an example about sending a message after each submission, with # to append the line to the beginning, and we don't need it. We don't need it. Adding our orders to the last face, actually a line.

svn up/wwwroot/svn-preview/--username=my-svn-username --password=my-svn-password

Submit a file to svn, and then visit it to see if it's normal.