svn export makes my page blank
I'm using LAMP with CodeIgniter f开发者_运维知识库or one of my projects; version controlled by SVN. Every time I execute svn export file:///svnrepo/project/trunk/www . --force
when in the www directory and then reload the web page, it goes blank.
The website only shows up after I do a service httpd restart
(Using CentOS 5).
I want to be able to execute the svn export using a Phing build script in the future and I don't want to have to get root privileges and restart apache every time when I do a build.
Is what I'm experience a common problem? How do I solve it without restarting apache?
Edit: It seems someone has had this problem before: http://codeigniter.com/forums/viewthread/181642/
Ok I got it.SVN maintains a files last modified time which throws off the APC cache. So to solve it we update the last modified time of all the files after we run an SVN export. Here is my final script:
#!/bin/sh
svn export --force file:///home/steve/repo/exmaple/trunk \
/home/steve/public_html/example.com/public/
find /home/steve/public_html/exmaple.com/public | xargs touch
You can find more details here.
An alternative solution would be to set apc.stat=0 (reference) in the apc.ini, and then use apc_clear_cache()
(reference) to force the removal of the opcode cache.
What's awesome about this solution is that when apc.stat
is set to 0, it disables the check on each request to determine if the file has been modified. This results in a huge performance boost.
Additionally, using apc_clear_cache()
to clear the APC cache tends to result in a cleaner build. I've run into wonky race conditions where certain files will get built out that have dependencies on others that have not yet been built out. This results in a spat of FATAL errors. The only caveat here is that apc_clear_cache()
needs to be run via apache, so you'll need to implement a wget
or something similar for this.
精彩评论