Question

I'm working out the kinks in the deployment of my webapp in development, but I've finally hit one I can't figure out on my own.

I have a post-commit hook in my svn that deploys all of my commits to a staging site, to ensure nothing breaks before I push to production. Thus, assuming my local working copy has no pending commits, localhost and staging have identical files.

Right now, my localhost works perfectly fine (the codebase isn't complete, but that's an entirely separate issue). On my staging site, however, I get the following exception from Kohana framework:

View_Exception [ 0 ]: The requested view index.tpl could not be found

If I manually visit the uris for my other controllers, I get the same message, with the template filename substituted. Following the stack trace, the error is occurring in the before function of the View factory, when the framework attempts to load my template file -- as expected.

My views directory (and all the files contained therein) has the same permissions as all of the other directories in my project, so I'm not sure why PHP wouldn't be able to read the directory or the files. I've also confirmed that the files do in fact exist on the server.

My error log shows nothing; my access log shows a 500 error. The Kohana logfile shows the same information that appears on-screen.

I'm genuinely confused as to why this is happening. The framework is obviously functioning, as I'm getting Kohana's formatted exception and the Kohana log is being written to. The autoloader is finding my controller classes, because the "missing" file changes appropriately as I visit my various controllers which use different templates. But the server's behavior doesn't match my localhost, and I'm left scratching my head.


After looking at Kohana::find_file, the method that's returning false, I came to the conclusion that Kohana was looking for index.tpl.php. I added some trace debugging to confirm, and I was correct: on my localhost, Kohana is looking for views\index.tpl while on my server, it's looking for views/index.tpl.php. However, a second oddity appeared, which may explain the first. Here is the full list of files that find_file tries to look for when loading up my index page on my local machine and my server:

LOCAL:                                             SERVER:
classes\I18n.php                                   classes/I18n.php
classes\Kohana\I18n.php                            classes/Kohana/I18n.php
classes\HTTP.php                                   classes/HTTP.php
classes\Kohana\HTTP.php                            classes/Kohana/HTTP.php
classes\Kohana\Exception.php                       classes/Kohana/Exception.php
classes\Kohana\Kohana\Exception.php                classes/Kohana/Kohana/Exception.php
classes\Log.php                                    classes/Log.php
classes\Kohana\Log.php                             classes/Kohana/Log.php
classes\Config.php                                 classes/Config.php
classes\Kohana\Config.php                          classes/Kohana/Config.php
classes\Log\File.php                               classes/Log/File.php
classes\Kohana\Log\File.php                        classes/Kohana/Log/File.php
classes\Log\Writer.php                             classes/Log/Writer.php
classes\Kohana\Log\Writer.php                      classes/Kohana/Log/Writer.php
classes\Config\File.php                            classes/Config/File.php
classes\Kohana\Config\File.php                     classes/Kohana/Config/File.php
classes\Kohana\Config\File\Reader.php              classes/Kohana/Config/File/Reader.php
classes\Kohana\Config\Reader.php                   classes/Kohana/Config/Reader.php
classes\Kohana\Config\Source.php                   classes/Kohana/Config/Source.php
classes\Route.php                                  classes/Route.php
classes\Kohana\Route.php                           classes/Kohana/Route.php
classes\Cookie.php                                 classes/Cookie.php
classes\Kohana\Cookie.php                          classes/Kohana/Cookie.php
classes\Session.php                                classes/Session.php
classes\Kohana\Session.php                         classes/Kohana/Session.php
classes\Request.php                                classes/Request.php
classes\Kohana\Request.php                         classes/Kohana/Request.php
classes\HTTP\Request.php                           classes/HTTP/Request.php
classes\Kohana\HTTP\Request.php                    classes/Kohana/HTTP/Request.php
classes\HTTP\Message.php                           classes/HTTP/Message.php
classes\Kohana\HTTP\Message.php                    classes/Kohana/HTTP/Message.php
classes\HTTP\Header.php                            classes/HTTP/Header.php
classes\Kohana\HTTP\Header.php                     classes/Kohana/HTTP\Header.php
classes\Request\Client\Internal.php                classes/Request/Client/Internal.php
classes\Kohana\Request\Client\Internal.php         classes/Kohana/Request/Client/Internal.php
classes\Request\Client.php                         classes/Request/Client.php
classes\Kohana\Request\Client.php                  classes/Kohana/Request/Client.php
classes\Arr.php                                    classes/Arr.php
classes\Kohana\Arr.php                             classes/Kohana/Arr.php
classes\Response.php                               classes/Response.php
classes\Kohana\Response.php                        classes/Kohana/Response.php
classes\HTTP\Response.php                          classes/HTTP/Response.php
classes\Kohana\HTTP\Response.php                   classes/Kohana/HTTP/Response.php
classes\Profiler.php                               classes/Profiler.php
classes\Kohana\Profiler.php                        classes/Kohana/Profiler.php
classes\Controller\Home.php                        classes/Controller/Home.php
classes\Controller\HFTemplate.php                  classes/Controller/HFTemplate.php
classes\Controller\Template.php                    classes/Controller/Template.php
classes\Kohana\Controller\Template.php             classes/Kohana/Controller/Template.php
classes\Controller.php                             classes/Controller.php
classes\Kohana\Controller.php                      classes/Kohana/Controller.php
classes\View.php                                   classes/View.php
classes\Kohana\View.php                            classes/Kohana/View.php
classes\Smarty\View.php
config\smarty.php
classes\Config\Group.php
classes\Kohana\Config\Group.php
vendor\smarty/libs/Smarty.class.php
classes\URL.php
classes\Kohana\URL.php
classes\Smarty\Helper.php
classes\Kohana\Smarty\Helper.php
views\index.tpl                                    views/index.tpl.php
classes\Auth.php
classes\Kohana\Auth.php
config\auth.php
classes\Auth\ORM.php
classes\Kohana\Auth\ORM.php
config\session.php
classes\Session\Database.php
classes\Kohana\Session\Database.php
classes\Database.php
classes\Kohana\Database.php
config\database.php
classes\Database\PDO.php
classes\Kohana\Database\PDO.php
classes\DB.php
classes\Kohana\DB.php
classes\Database\Query\Builder\Select.php
classes\Kohana\Database\Query\Builder\Select.php
classes\Database\Query\Builder\Where.php
classes\Kohana\Database\Query\Builder\Where.php
classes\Database\Query\Builder.php
classes\Kohana\Database\Query\Builder.php
classes\Database\Query.php
classes\Kohana\Database\Query.php
classes\Database\Result\Cached.php
classes\Kohana\Database\Result\Cached.php
classes\Database\Result.php
classes\Kohana\Database\Result.php
classes\ORM.php
classes\Kohana\ORM.php
classes\Model.php
classes\Kohana\Model.php
classes\Model\User.php
classes\Model\Auth\User.php
classes\Inflector.php
classes\Kohana\Inflector.php
config\inflector.php
classes\UTF8.php
classes\Kohana\UTF8.php
classes\Model\Role.php
classes\Model\Auth\Role.php
                                                   classes/View/Exception.php
                                                   classes/Kohana/View/Exception.php
                                                   classes/Debug.php
                                                   classes/Kohana/Debug.php
                                                   classes/Date.php
                                                   classes/Kohana/Date.php
                                                   views/kohana/error.php
                                                   classes/Text.php
                                                   classes/Kohana/Text.php
(page content)                                     (exception page content)
classes\Database\Query\Builder\Update.php
classes\Kohana\Database\Query\Builder\Update.php

There is a gap where the system ought to be getting the Smarty module classes, but isn't. After seeing this, I confirmed that the Smarty module does in fact exist on the server and that it's enabled in Kohana's bootstrap. Yet it isn't being loaded. Any ideas?

Was it helpful?

Solution

As it turns out, the root of the issue was case-sensitivity on Linux. I arrived at this conclusion with the help of the module author on his GitHub repository. I assume he will fix this error in the repository in the near future, however, the fix was changing the names of 4 files:

  • MODPATH/smarty/classes/view.php to View.php
  • MODPATH/smarty/classes/Smarty/view.php to View.php
  • MODPATH/smarty/classes/Smarty/helper.php to Helper.php
  • MODPATH/smarty/classes/Kohana/Smarty/helper.php to Helper.php
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top