Zend Framework: Fatal error on the server - zend-framework

I'm trying to put a ZF website on the Internet which works well on my local machine (WAMP).
But on the Linux server, only the main page can be properly displayed. For the other pages, I've got a fatal error:
Fatal error: Uncaught exception
'Zend_Controller_Dispatcher_Exception' with message 'Invalid
controller specified (error)' in
/var/www/staging/library/Zend/Controller/Dispatcher/Standard.php:248
Stack trace: #0
/var/www/staging/library/Zend/Controller/Front.php(954):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #1
/var/www/staging/library/Zend/Application/Bootstrap/Bootstrap.php(97):
Zend_Controller_Front->dispatch() #2
/var/www/staging/library/Zend/Application.php(366):
Zend_Application_Bootstrap_Bootstrap->run() #3
/var/www/staging/public/index.php(26): Zend_Application->run() #4
{main} Next exception 'Zend_Controller_Exception' with message
'Invalid controller specified (error)#0
/var/www/staging/library/Zend/Controller/Front.php(954):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Contr in
/var/www/staging/library/Zend/Controller/Plugin/Broker.php on line
336.
I activated the URL rewriting. I'm using modules. The index.php and application.ini are very basic, we didn't custumize it.
I suppose that there is something wrong with the configuration... Thanks.

When deploying application from windows platform to Linux, most typical type of error that can be encountered is due to the filename cases. Linux system are very strict about file name and cases.
The error you are encountering is also probably one of these cases. Check the name of ErrorContainer.php and try to match the name you specify in your route and file system.

In changing server Windows => Linux. The first main things to check is ignore case in Windows. Check filenames and class names if spelled with proper first capital letter etc.

Related

Custom View Helpers are not Getting Loaded on Server

I have some custom form elements that use custom view helpers in my Zend Framework project. They get loaded and work properly on development machine but when I move the project over to my EC2 server they don't get loaded.
From application.ini:
resources.view.helperPath.Custom_View_Helper_ = APPLICATION_PATH "/../library/Custom/View/Helper/"
Error returned by server:
Warning: Exception caught by form: Plugin by name 'Multiselect' was not found in the registry;
used paths:
Application_Views_Helpers_Fields_: /home/user/hippo/application/views/helpers/fields/
Application_Views_Helpers_: /home/user/hippo/application/views/helpers/
Custom_View_Helper_: /home/user/hippo/application/../library/Custom/View/Helper/
Zend_View_Helper_: Zend/View/Helper/:/home/user/hippo/application/views/helpers/ Stack
Trace:
#0 /home/user/hippo/library/Zend/View/Abstract.php(1182): Zend_Loader_PluginLoader->load('Multiselect')
#1 /home/user/hippo/library/Zend/View/Abstract.php(618): Zend_View_Abstract->_getPlugin('helper', 'multiselect')
#2 /home/user/hippo/library/Zend/Form/Decorator/ViewHelper.php(241): Zend_View_Abstract->getHelper('multiselect')
#3 /home/user/hippo/library/Zend/Form/Element.php(2043): Zend_Form_Decorator_ViewHelper->render('')
#4 /home/user/hippo/library/Zend/Form/Decorator/FormElements.php(111): Zend_Form_Element->render()
#5 /home/user/hippo/library/Zend/ in /home/user/hippo/library/Zend/Form.php on line 2925
What could cause this to work on my dev machine but not on EC2?
I figured out the problem. My dev machine is a Mac and EC2 is running Linux. I had to change public $helper='multiselect' to public $helper='multiSelect' so it would search for the file name MultiSelect.php instead of Multiselect.php when searching for the view helper.

Zend Framework ACL doesn't work properly when it call model_dbtable

Hy Somebody!
I have a question I want to solve in Zend Framework. The situation is the following: I have an indexController, where I placed a getAktGroupMailAction - what is on my ACL - like here:
public function getAktGroupMail(){
$ggroup = new Application_Model_DbTable_Groups();
//return $groupN = $ggroup->getUserAktGroupMail();
}
If I don't put "//" characters before the word "return" I get the error messages:
Fatal error: Uncaught exception 'Zend_Acl_Exception' with message 'Resource 'error' not found' in /var/www/hobu/library/Zend/Acl.php:365 Stack trace: #0 /var/www/hobu/library/Zend/Acl.php(846): Zend_Acl->get('error') #1 /var/www/hobu/application/plugins/AccessCheck.php(19): Zend_Acl->isAllowed('user', 'error', 'error') #2 /var/www/hobu/library/Zend/Controller/Plugin/Broker.php(309): Application_Plugin_AccessCheck->preDispatch(Object(Zend_Controller_Request_Http)) #3 /var/www/hobu/library/Zend/Controller/Front.php(941): Zend_Controller_Plugin_Broker->preDispatch(Object(Zend_Controller_Request_Http)) #4 /var/www/hobu/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() #5 /var/www/hobu/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #6 /var/www/hobu/public/index.php(26): Zend_Application->run() #7 {main} Next exception 'Zend_Controller_Exception' with message 'Resource 'error' not found#0 /var/www/hobu/library/Zend/Acl.php(846): Zend_Acl->get('error') #1 /va in /var/www/hobu/library/Zend/Controller/Plugin/Broker.php on line 312
Somebody could help me?
You've not included the code for your 'Access Check' plugin which is what's generating the error, but I'm guessing what this does is call Zend_Acl using the current controller/action name. If so, the underlyng problem is not ACL related. Your $groupN = $ggroup->getUserAktGroupMail() is throwing an exception, which is causing the request to be routed to the error controller. Since you've not setup a resource called 'error', this then generates an ACL error when it checks whether the user can access that controller.
I'd suggest you modify your access check plugin so it does not check permissions if the controller name is 'error'. This should get rid of your ACL error message and let you see and fix the underlying problem.

Zend Framework Migration to Live Server

Pardon me guys, I am new to ZF. I need to move my codes from MAMP production server to LAMP Live Server.
When I am working on localhost with the codes are all working fine. However when I upload it to live server, 60% of the modules reflect this error.
Fatal error: Uncaught exception 'Zend_View_Exception' with message
'script 'layout.phtml' not found in path
(/home/lifeoppc/public_html/application/layouts/:/home/lifeoppc/public_html/application/modules/default/views/scripts/:./views/scripts/)'
in /home/lifeoppc/public_html/public/Zend/View/Abstract.php:988 Stack
trace: #0
/home/lifeoppc/public_html/public/Zend/View/Abstract.php(884):
Zend_View_Abstract->_script('layout.phtml') #1
/home/lifeoppc/public_html/public/Zend/Layout.php(796):
Zend_View_Abstract->render('layout.phtml') #2
/home/lifeoppc/public_html/public/Zend/Layout/Controller/Plugin/Layout.php(143):
Zend_Layout->render() #3
/home/lifeoppc/public_html/public/Zend/Controller/Plugin/Broker.php(333):
Zend_Layout_Controller_Plugin_Layout->postDispatch(Object(Zend_Controller_Request_Http))
#4 /home/lifeoppc/public_html/public/Zend/Controller/Front.php(965): Zend_Controller_Plugin_Broker->postDispatch(Object(Zend_Controller_Request_Http))
#5 /home/lifeoppc/public_html/public/Zend/Application/Bootstrap/Bootstrap.php(9
in /home/lifeoppc/public_html/public/Zend/Controller/Plugin/Broker.php
on line 336
I really really need help! Site is going live on Monday and I am really desperate right now =(
Search for file layout.phtml inside your project and then copy paste it inside directory
/home/lifeoppc/public_html/application/layouts/

New Server: Zend_Session_Exception "session has already been started" http to https & vice versa

I'm trying to move a website to a new host (MediaTemple.)
When you stick to http, or https everything is fine. When going from http->https or https->http you get the error.
Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()'
in /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Session.php:462
Stack trace:
#0 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#1 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Auth/Storage/Session.php(87): Zend_Session_Namespace->__construct('Zend_Auth')
#2 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Auth.php(91): Zend_Auth_Storage_Session->__construct()
#3 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Auth.php(141): Zend_Auth->getStorage()
#4 /var/www/vhosts/FakeSite.com/httpdocs/application/layouts/layout.phtml(12): Zend_Auth->hasIdentity()
#5 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/View.php(108): include('/var/www/vhosts...')
#6 /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/View/Abstract.php(831): Zend_View->_run('/var/www/vhosts...')
#7 /var/www/vh in /var/www/vhosts/FakeSite.com/httpdocs/library/Zend/Session.php on line 462
Session path is writable, and seems to work fine if you stick to one protocol. There are no session_start() calls, and session.auto-start is 0.
Code is running on 3 other servers fine. It must be a configuration issue, but I haven't been able to find it
Sure looks like the server is configured with session.auto_start = 1.
So, maybe add to configs/application.ini:
phpSettings.session.auto_start = 0
I think you have a plugin(or other library), which calls session_start() function
I had the same problem, when tried to create facebook resource
I figured finally it out.
Problem was that PHP on http was running as an Apache module, and PHP on https was running as a FastCGI module.
I assume those run as different users on MediaTemple or something. The session would get created by one, and not be able to be read by the other because another user owned the file.

Zend frame work Database connection and configuration

I am very new to zend frame work , I want to do some updation work in one project that already done by other programmers, now iam trying to setting up this project in my local server (I am using xamp), i have created the database in phpmyadmin, but while running this project i got the following error....
"Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'SQLSTATE[28000] [1045] Access denied for user 'numberfo_admin'#'localhost' (using password: NO)' in C:\xampp\php\PEAR\Zend\Db\Adapter\Pdo\Abstract.php:144 Stack trace: #0 C:\xampp\php\PEAR\Zend\Db\Adapter\Pdo\Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect() #1 C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php(832): Zend_Db_Adapter_Pdo_Mysql->_connect() #2 C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php(902): Zend_Db_Adapter_Abstract->quote(1257218565, NULL) #3 C:\xampp\htdocs\NFL_021\library\Utils\session_handling.php(16): Zend_Db_Adapter_Abstract->quoteInto('last_login_date...', 1257218565) #4 C:\xampp\htdocs\NFL_021\application\controllers\IndexController.php(16): require_once('C:\xampp\htdocs...') #5 C:\xampp\php\PEAR\Zend\Controller\Action.php(513): IndexController->indexAction() #6 C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php(289): Zend_Controller_Action->dispatch('indexAction') #7 C:\xampp\php\PEAR\Zend\Controller\Front.php(946 in C:\xampp\php\PEAR\Zend\Db\Adapter\Pdo\Abstract.php on line 144"
Plsss any one help me to fix this error........
It looks like you either have incorrect permissions set up with MySql or you're trying to access the database using wrong credentials from Zend Framework. Verify that you can log in to the database with the credentials you're trying to use (via phpMyAdmin). Also verify that in Zend Framework you're using the credentials that indeed have access to the database in question.
Set password for Mysql user (it my be «root» or some other).
Then edit Zend configuration file such as application.ini