[pmwiki-users] Intermittent Problem with creating pages.
Patrick R. Michaud
pmichaud at pobox.com
Tue Jul 10 16:38:11 CDT 2007
On Tue, Jul 10, 2007 at 08:34:59AM -0400, Ben Wilson wrote:
> The quoted section below occurs intermittently when I try to create a
> page (using WritePage()) in a function put at the end via
> register_function_shutdown(). I don't know why, but it appears that
> PmWiki forgets where wiki.d is. Sometimes it works, which is why I
> scratch my head.
It's not that PmWiki forgets where wiki.d/ is, it's that PHP sometimes
changes the working directory when using register_shutdown_function() .
Quoting from the PHP manual page :
Note: Working directory of the script can change inside
the shutdown function under some web servers, e.g. Apache.
Since PmWiki defaults wiki.d/ to being relative to the current
directory, using it inside of a shutdown function can cause problems.
This is why all of PmWiki's use of register_shutdown_function()
include an argument containing the path of the current working
directory at the time the function is called. The shutdown function
can then switch back to the appropriate directory before making
any accesses to wiki.d/ or other relatively-pathed directories.
More information about the pmwiki-users