[fw-general] Re: Problems autoloading modules on shared hosting
The solution was so simple! The bootstrap.php file in each of my module root directories started with a lowercase b instead of B. Zend_Application_Resource_Modules is hardcoded to look for /modulepath/Bootstrap.php. Now my modules are loading perfectly. It took so long to figure out because I was setting the bootstrap filename for the default module specifically with a lower case b in the config ini. The other thing I fixed was moving the main bootstrap from being directly under my application directory into the root of my default module. I removed the extra autoload function from my Module_Bootstrap since I was getting duplicate autoloader instances for my module. The default module still needed to by autoloaded even though it was under the module directory. I hope this helps others to avoid lost days and lost hair. Shaun -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Problems-autoloading-modules-on-shared-hosting-tp2063729p2074885.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Problems autoloading modules on shared hosting
I modified my setup a bit after doing more research on fixing my issue...(Issue still unresolved!) I have removed the following function from my bootstrap located in the root/application directory protected function _initAutoload() { $loader = new Zend_Application_Module_Autoloader( array( 'namespace' = '', 'basePath' = APPLICATION_PATH . '/modules/default'), array( 'namespace' = 'Membership_', 'basePath' = APPLICATION_PATH . '/modules/membership')); return $loader; } I added module specific bootstrap files to both the default and membership modules, and split up the above function into the corresponding module. For example, I added the following function to root/application/modules/membership: protected function _initAutoload() { $loader = new Zend_Application_Module_Autoloader( array( 'namespace' = 'Membership_', 'basePath' = APPLICATION_PATH . '/modules/membership')); return $loader; } and this to root/application/modules/default: { $loader = new Zend_Application_Module_Autoloader( array( 'namespace' = '', 'basePath' = APPLICATION_PATH . '/modules/default'), return $loader; } My application.ini file in root/application/config contains the following resources entries: resources.frontController.moduleDirectory = APPLICATION_PATH /modules resources.frontController.defaultControllerName = index resources.frontController.defaultAction = index resources.frontController.defaultModule = default resources.frontController.baseUrl = /public resources.modules[] = The line resources.modules[]= should be executing the module autoloaders in each of the module specific bootstraps. Viola...that should be all that is needed to setup basic modules...correct? All of this is extra since the original method of setup worked on a localhost setup, but did not translate to shared hosting. If I remove the call to Membership_Form_Login from my front layout, then the default/index/index action loads perfectly. That tells me that on the shared setup my default module is located and working (for the index controller at least). Why is the framework unable to autoload the Membership_Form_Login class on shared hosting, but can find it on the local setup? Is there any other information that I could post to kick start some ideas? I have compared the location path that calls Membership_Form_Login on my local setup to the location path on the hosted site including case sensitivity. I have tested my htaccess setup by keying in a path to any other file that I uploaded (ex: web-root/application/config/application.ini), and that test took me back to my index.php gateway file. I can successfully pull up files in my public folder (ex: css or images). Any suggestions about what to look at next? Thank you, Shaun -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Problems-autoloading-modules-on-shared-hosting-tp2063729p2065655.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Problems autoloading modules on shared hosting
Hi all, This is working locally on an OSX machine in Eclipse. Does not work when loaded to a Godaddy hosted site. The error I am getting is: Fatal error: Class 'Membership_Form_Login' not found in /home/content/s/h/a/shamik/html/application/modules/membership/views/helpers/UserDoorway.php on line 27 I'm having a problem autoloading classes located under the modules directory. My directory structure is root -application --modules ---default ---membership forms -Login all directories are lowercase as indicated. My config file has the following entries: resources.frontController.moduleDirectory = APPLICATION_PATH /modules resources.frontController.defaultControllerName = index resources.frontController.defaultAction = index resources.frontController.defaultModule = default resources.frontController.baseUrl = /public resources.modules[] = My only bootstrap file is under the application directory. It has an init function as follows: protected function _initAutoload() { $loader = new Zend_Application_Module_Autoloader(array( 'namespace' = '', 'basePath' = APPLICATION_PATH)); return $loader; } The class that is trying to load is Membership_Form_Login. I tested creating a dummy class under the default module called Form_Login, and have a new instance create early in the default index/index controller/action. I receive the same error as when trying to load the same class under the membership module: Fatal error: Class 'Form_Test' not found in /home/content/s/h/a/shamik/html/application/modules/default/controllers/IndexController.php on line 16 The application is correctly loading view helpers within the membership module as indicated in the following bootstrap line: $view-addHelperPath(APPLICATION_PATH . '/modules/membership/views/helpers', 'Membership_View_Helper'); The same code is working locally, so I do not think this is a setup issue. I have checked the path that the autoloader looks for the class in, and aside from the server root it matches my path correctly. I do not see any case sensitivity issues as I have with other errors I got earlier in testing on Godaddy. Thank you, shaun sandlin -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Problems-autoloading-modules-on-shared-hosting-tp2063729p2063729.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Re: Problems autoloading modules on shared hosting
I checked out your Rob's link again (his help has been invaluable in the past), but still come up empty. I did a little modification since I'm using a modules directory instead of putting the ZF standard directories under my application dir. Each module has a standard set of folders under them as recommended in the Reference guide for using modules. Here is my updated bootstrap function for autoloading (I've tried the membership namespace with and without the underscore): protected function _initAutoload() { $loader = new Zend_Application_Module_Autoloader( array( 'namespace' = '', 'basePath' = APPLICATION_PATH . '/modules/default'), array( 'namespace' = 'Membership_', 'basePath' = APPLICATION_PATH . '/modules/membership')); return $loader; } I also think that since the code itself is proven to work locally, that it should also work remotely. The things that would cause it to work locally but not remotely include: case sensitivity and environment setup. My .htaccess file is in the web-root, and looks like this: RewriteEngine On RewriteRule ^\.htaccess$ - [F] RewriteCond %{REQUEST_URI} = RewriteRule ^.*$ /public/index.php [NC,L] RewriteCond %{REQUEST_URI} !^/public/.*$ RewriteRule ^(.*)$ /public/$1 RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^.*$ - [NC,L] RewriteRule ^public/.*$ /public/index.php [NC,L] The same rewrite rules are working locally with my application. Using the base domain name will take me to the default index remotely, so I take that to indicate that my include paths and routing through /public/index.php are working properly. -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Problems-autoloading-modules-on-shared-hosting-tp2063729p2063957.html Sent from the Zend Framework mailing list archive at Nabble.com.