Peter Falkenberg Brown Posted January 5, 2017 Share Posted January 5, 2017 Hello PW Gurus: I just upgraded my site from 2.7 to 3.0.42. I thought all was well until I went to a couple of pages that had embedded forms. I embed them by a hand-rolled method like Hanna code. I have a field called "code_block1" in which I place the html form, and then in the body / rich text field, I add a tag: {{code_block1}} and then replace the tag with the code at run time. Under 3.0.42, I get this error: Error: Exception: DirectoryIterator::__construct(/home/USERNAME/.checkers/): failed to open dir: Permission denied (in /home/USERNAME/public_html/wire/core/FileCompiler.php line 817) The form references a few Perl and HTML files that exist in the public_html dir and above it. (e.g. the form action is a .cgi script in public_html.) I thought perhaps it was because the form referenced the parent "home" dir above public_html, but when I changed the ".." syntax to "." it still failed. So, I removed the form from the code block field, and the page worked. The error above references what looks like an anti-virus directory (".checkers"), which is owned by root (600). Thus, PW couldn't get into it. However, there are a number of other dirs in the home directory that are also owned by root (it's a cpanel box), so I don't think it's specific to the ".checkers" dir -- it's simply choking on a root only dir in the home directory. I think the issue is that FileCompiler.php is trying to iterate above the public_html dir, which it shouldn't, in my opinion, but is doing so because of of file paths in the form. Not sure... I tried adding FileCompiler=0 in a comment in the template, but I got an error that the directive had to be at the top of the script. I use a whole bunch of include files for headers and footers, etc, and wrap around templates, so that I can have a few unique templates for the "middle" of the pages, so if I put the directive at the very top, it will not compile any of the templates. I tried adding $config->templateCompile = false; to the config.php file, but then I got this error, from a menu template: Recoverable Fatal Error: Argument 1 passed to menu_post_process() must be an instance of HookEvent, instance of ProcessWire\HookEvent given, called in /home/USER/public_html/wire/core/WireHooks.php on line 625 and defined (line 80 of /home/USER/public_html/site/templates/inc_create_menu_mobile.php) The menu file uses MarkupSimpleNavigation. On line 80, I have this function: function menu_post_process(HookEvent $event) { $page = $event->arguments[1]; $new_code = $event->return; # check for open_in_new_tab if($page->open_in_new_tab) { $new_code = str_replace('href=','target="_blank" href=', $new_code); } $event->return = $new_code; } The menu works fine until I add the template compile directive to the config.php file. I realize that the menu issue is a secondary issue -- I think. So, I'm stumped. I need to use a variety of forms, so I can't abandon them. Thanks for any help! Peter Link to comment Share on other sites More sharing options...
Peter Falkenberg Brown Posted January 6, 2017 Author Share Posted January 6, 2017 Dear All, I'm hoping this is just a 3.x config tweak. But as it stands, 3.x has broken my embedded html forms, which is a real problem. I really, really don't want to roll back or go with 2.8. Hoping for genius input.... Peter Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 6, 2017 Share Posted January 6, 2017 The FileCompiler does not automatically iterate over any folders or files. It does only compile files directly included by processwire (modules/templates and so on) and any files included in any of those files. Link to comment Share on other sites More sharing options...
Peter Falkenberg Brown Posted January 7, 2017 Author Share Posted January 7, 2017 Thanks, LostKobrakai, My form has a function in a file in the template directory that includes a captcha php file in the /home/USER directory. When I placed: # FileCompiler=0 at the top of the included php file (the one in the /home/USER directory), the error went away. The problem must have been that FileCompiler went to work on the included php file in the home directory and then tried to click through the other subdirectories in the home directory. If I had moved that file to the site/template directory, it might not have had that problem (I presume). I didn't test that because the declaration above fixed it. Thanks for your help! Peter Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now