FAQ
Having developed my application sufficiently to see it working well so
far, I though I should configure it to run under mod_perl. I have used
the TTSite helper to generate the templates. The app runs fine using
myapp_server.pl, but under mod_perl I get the following:

Couldn't render template "file error - login.tt2: not found"

I have a conventional setup (I think) with MyApp::View::TT config:
__PACKAGE__->config({
INCLUDE_PATH => [
MyApp->path_to( 'root', 'src' ),
MyApp->path_to( 'root', 'lib' )
],
# etc
});

The Apache mod_perl startup params include /path/to/MyApp/lib

Replacing INCLUDE_PATH with full pathnames ie /full/path/to/root/src and
/full/path/to/root/lib doesn't help, perhaps suggesting MyApp::View::TT
is not being found?

Catalyst::Helper::View::TTSite docs state that 'The view module that the
helper creates is automatically configured to locate these templates.'
Is there anything I have forgoten to do to port the application to
mod_perl that would explain this error?

--
Richard Jones

Search Discussions

  • Grün Christian-Rolf at Jun 29, 2007 at 11:22 am

    Richard Jones wrote:
    Having developed my application sufficiently to see it working well so
    far, I though I should configure it to run under mod_perl. I have used
    the TTSite helper to generate the templates. The app runs fine using
    myapp_server.pl, but under mod_perl I get the following:

    Couldn't render template "file error - login.tt2: not found"
    Could be a permission issue, has the user the webserver runs under
    access to that path / those files?
  • Richard Jones at Jun 29, 2007 at 11:49 am

    Kiki wrote:
    Richard Jones wrote:
    Having developed my application sufficiently to see it working well so
    far, I though I should configure it to run under mod_perl. I have used
    the TTSite helper to generate the templates. The app runs fine using
    myapp_server.pl, but under mod_perl I get the following:

    Couldn't render template "file error - login.tt2: not found"
    Could be a permission issue, has the user the webserver runs under
    access to that path / those files?


    _______________________________________________
    The user/group permissions on root/src and root/lib and the files
    therein are the same as for lib/MyApp.pm, so presumably that isn't the
    issue? There is nothing obvious in the error_log, though Apache doesn't
    seem to log file permission errors even under debug mode.

    --
    Richard Jones
  • Matt S Trout at Jun 29, 2007 at 5:19 pm

    On Fri, Jun 29, 2007 at 11:49:33AM +0100, Richard Jones wrote:
    Kiki wrote:
    Richard Jones wrote:
    Having developed my application sufficiently to see it working well so
    far, I though I should configure it to run under mod_perl. I have used
    the TTSite helper to generate the templates. The app runs fine using
    myapp_server.pl, but under mod_perl I get the following:

    Couldn't render template "file error - login.tt2: not found"
    Could be a permission issue, has the user the webserver runs under
    access to that path / those files?


    _______________________________________________
    The user/group permissions on root/src and root/lib and the files
    therein are the same as for lib/MyApp.pm, so presumably that isn't the
    issue? There is nothing obvious in the error_log, though Apache doesn't
    seem to log file permission errors even under debug mode.
    Apache may load code while still root.

    su to the user it runs at and try to cd into the MyApp dir and cat a template
    file.

    --
    Matt S Trout Need help with your Catalyst or DBIx::Class project?
    Technical Director Want a managed development or deployment platform?
    Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
    http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/
  • Richard Jones at Jun 29, 2007 at 5:27 pm

    Richard Jones wrote:
    Kiki wrote:
    Richard Jones wrote:
    Having developed my application sufficiently to see it working well so
    far, I though I should configure it to run under mod_perl. I have used
    the TTSite helper to generate the templates. The app runs fine using
    myapp_server.pl, but under mod_perl I get the following:

    Couldn't render template "file error - login.tt2: not found"
    Could be a permission issue, has the user the webserver runs under
    access to that path / those files?


    _______________________________________________
    The user/group permissions on root/src and root/lib and the files
    therein are the same as for lib/MyApp.pm, so presumably that isn't the
    issue? There is nothing obvious in the error_log, though Apache
    doesn't seem to log file permission errors even under debug mode.
    OK, contrary to my previous post, it clearly is a file permissions issue
    (thanks KiKi), as chmod 777 * -R in MyApp fixed the problem at a stroke
    (it's not on a public server!). Changing all directories to 755 and
    files to 644 (or 666 if need to be writable) seems to retain functionality.

    Could I have avoided this embarrassment by using Makefile.PL in the app
    directory? OT I know, but what is the recommended permissions for files
    and directories for web-apps run under Catalyst/mod_perl?

    --
    Richard Jones
  • Aristotle Pagaltzis at Jun 29, 2007 at 9:11 pm

    * Richard Jones [2007-06-29 18:35]:
    OK, contrary to my previous post, it clearly is a file
    permissions issue (thanks KiKi), as chmod 777 * -R in MyApp
    fixed the problem at a stroke (it's not on a public server!).
    Changing all directories to 755 and files to 644 (or 666 if
    need to be writable) seems to retain functionality.
    It should never be necessary to make a file or directory world-
    writable. If you find yourself needing to, then you?ve done
    something wrong with the account situation on the machine.

    (I know you said this isn?t production; I wanted to reinforce
    that this is a Bad Idea.)

    Regards,
    --
    Aristotle Pagaltzis // <http://plasmasturm.org/>
  • Jason Kohles at Jun 29, 2007 at 1:49 pm

    On Jun 29, 2007, at 5:47 AM, Richard Jones wrote:

    Having developed my application sufficiently to see it working well
    so far, I though I should configure it to run under mod_perl. I
    have used the TTSite helper to generate the templates. The app runs
    fine using myapp_server.pl, but under mod_perl I get the following:
    Depending on how you installed it under mod_perl, you may find that
    you need to set 'home' in your configuration for path_to to work, if
    you don't explicitly set the path to the home directory, Catalyst
    will try to figure it out by looking for your Makefile.PL/Build.PL or
    by figuring out where the libraries are installed, but that may not
    be the correct location for your root directory. Take a look at
    Catalyst::Utils for the home method to see how it figures it out...

    --
    Jason Kohles
    email@jasonkohles.com
    http://www.jasonkohles.com/
    "A witty saying proves nothing." -- Voltaire
  • Richard Jones at Jun 29, 2007 at 2:20 pm

    Jason Kohles wrote:
    On Jun 29, 2007, at 5:47 AM, Richard Jones wrote:

    Having developed my application sufficiently to see it working well
    so far, I though I should configure it to run under mod_perl. I have
    used the TTSite helper to generate the templates. The app runs fine
    using myapp_server.pl, but under mod_perl I get the following:
    Depending on how you installed it under mod_perl, you may find that
    you need to set 'home' in your configuration for path_to to work, if
    you don't explicitly set the path to the home directory, Catalyst will
    try to figure it out by looking for your Makefile.PL/Build.PL or by
    figuring out where the libraries are installed, but that may not be
    the correct location for your root directory. Take a look at
    Catalyst::Utils for the home method to see how it figures it out...
    I didn't actually 'install' it as such, just copied the MyApp directory
    under my /home folder, added the path/to/MyApp/lib to mod_perl's lib in
    startup.pl file so it can find MyApp.pm, and re-started the server. It
    looks like Catalyst _can_ find the 'home' directory, as it displays
    correctly in the rather verbose 'Config' section of the screen dump:
    home => '/home/raj/www/apps/MyApp',
    and directly under that is root/lib and root/src. I REALLY need to fix
    this one or I'm sunk!

    --
    Richard Jones
  • Bill Moseley at Jun 29, 2007 at 2:52 pm

    On Fri, Jun 29, 2007 at 02:20:23PM +0100, Richard Jones wrote:
    I didn't actually 'install' it as such, just copied the MyApp directory
    under my /home folder, added the path/to/MyApp/lib to mod_perl's lib in
    startup.pl file so it can find MyApp.pm, and re-started the server. It
    looks like Catalyst _can_ find the 'home' directory, as it displays
    correctly in the rather verbose 'Config' section of the screen dump:
    home => '/home/raj/www/apps/MyApp',
    and directly under that is root/lib and root/src. I REALLY need to fix
    this one or I'm sunk!
    What debugging did you do? Did you dump the INCLUDE_PATH?
    Template::Provider also has some dubbing available. Did you enable
    that? Have you tried making a local copy of Template::Provider in
    your lib directory and throw in some warn statements?

    --
    Bill Moseley
    moseley@hank.org
  • Richard Jones at Jun 29, 2007 at 4:33 pm

    Bill Moseley wrote:
    On Fri, Jun 29, 2007 at 02:20:23PM +0100, Richard Jones wrote:

    I didn't actually 'install' it as such, just copied the MyApp directory
    under my /home folder, added the path/to/MyApp/lib to mod_perl's lib in
    startup.pl file so it can find MyApp.pm, and re-started the server. It
    looks like Catalyst _can_ find the 'home' directory, as it displays
    correctly in the rather verbose 'Config' section of the screen dump:
    home => '/home/raj/www/apps/MyApp',
    and directly under that is root/lib and root/src. I REALLY need to fix
    this one or I'm sunk!
    What debugging did you do? Did you dump the INCLUDE_PATH?
    In MyApp::View::TT:
    MyApp::Debug::DEBUG( __PACKAGE__->config->{INCLUDE_PATH} ):

    $VAR1 = [
    bless( {
    'file_spec_class' => undef,
    'volume' => '',
    'dirs' => [
    '',
    'home',
    'raj',
    'www',
    'apps',
    'MyApp',
    'root',
    'lib'
    ]
    }, 'Path::Class::Dir' ),
    bless( {
    'file_spec_class' => undef,
    'volume' => '',
    'dirs' => [
    '',
    'home',
    'raj',
    'www',
    'apps',
    'MyApp',
    'root',
    'templates'
    ]
    }, 'Path::Class::Dir' )
    ];

    This is correct - I moved the templates dir underneath MyApp/root.
    Template::Provider also has some dubbing available. Did you enable
    that? Have you tried making a local copy of Template::Provider in
    your lib directory and throw in some warn statements?
    No, I wasn't aware of it's existence! Even after reading the docs it's
    not clear (to me) how to use the $provider object within Catalyst to get
    the template path, or why this is any better than using the INCLUDE_PATH
    from MyApp::View::TT

    This is getting weirder - if I try to load a page normally available
    only after login, I get another path error in addition to the template
    error:
    Form (search): Can't find form config search.fb in:
    /home/raj/www/apps/MyApp/root/forms, yet search.fb is most definitely
    present in /home/raj/www/apps/MyApp/root/forms. All root sub-dir files
    set to 0644 permissions, with user/group set to same as other web files.
    What gives?

    --
    Richard Jones
  • Matt S Trout at Jun 29, 2007 at 6:30 pm

    On Fri, Jun 29, 2007 at 04:33:46PM +0100, Richard Jones wrote:
    This is getting weirder - if I try to load a page normally available
    only after login, I get another path error in addition to the template
    error:
    Form (search): Can't find form config search.fb in:
    /home/raj/www/apps/MyApp/root/forms, yet search.fb is most definitely
    present in /home/raj/www/apps/MyApp/root/forms. All root sub-dir files
    set to 0644 permissions, with user/group set to same as other web files.
    What gives?
    The directory needs to be 755.

    --
    Matt S Trout Need help with your Catalyst or DBIx::Class project?
    Technical Director Want a managed development or deployment platform?
    Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
    http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/
  • Bill Moseley at Jun 29, 2007 at 6:42 pm

    On Fri, Jun 29, 2007 at 04:33:46PM +0100, Richard Jones wrote:
    Form (search): Can't find form config search.fb in:
    /home/raj/www/apps/MyApp/root/forms, yet search.fb is most definitely
    present in /home/raj/www/apps/MyApp/root/forms. All root sub-dir files
    set to 0644 permissions, with user/group set to same as other web files.
    What gives?
    Do you know about the secret -m option to perldoc? -m is what give
    the real manual.

    perldoc -m Template::Provider and page down until you something handy:

    # _template_content($path)
    #
    # Fetches content pointed to by $path.

    Then you can do:[1]

    warn "Hey, TT is looking for [$path]\n";


    which might give you a lead.


    [1]

    $ cat ~/bin/mvim
    #!/bin/sh
    sudo vim `perldoc -l "$1"`


    --
    Bill Moseley
    moseley@hank.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJun 29, '07 at 10:47a
activeJun 29, '07 at 9:11p
posts12
users6
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase