I'm trying to deploy a website made with the Zend Framework. The website is running fine on my local environment, I'm trying to deploy it on my VPS. But I'm running into some difficulties.
Now it says the following:
*Fatal error: Class 'Doctrine_Manager' not found in /is/htdocs/wpxxxxx/www/mensenenjij/application/Bootstrap.php on line 12*
It properly includes the Doctrine classes but it can't instantiate a new Doctrine_Manager. Anybody knows why?
Bootstrap.php:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initDoctrine()
{
require_once 'Doctrine/Doctrine.php';
$this->getApplication()
->getAutoloader()
->pushAutoloader(array('Doctrine', 'autoload'), 'Doctrine');
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(
Doctrine::ATTR_MODEL_LOADING,
Doctrine::MODEL_LOADING_CONSERVATIVE
);
$config = $this->getOption('doctrine');
$conn = Doctrine_Manager::connection($config['dsn'], 'doctrine');
return $conn;
}
}
Related
I am creating a custom API for SuiteCRM. When I attempt to run the new API from {CRM Home}/custom/service/v4_1_custom I receive an 'HTTP ERROR 500'. There are not errors in the error_log file or the SuiteCRM.log file.
I have followed the method in the following two url's
https://fayebsg.com/2013/05/extending-the-sugarcrm-api-updating-dropdowns/
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.0/Integration/Web_Services/Legacy_API/Extending_Web_Services/
registry.php
<?php
require_once('service/v4_1/registry.php');
class registry_v4_1_custom extends registry_v4_1
{
protected function registerFunction()
{
parent::registerFunction();
$this->serviceClass->registerFunction('test', array(), array());
}
}
SugarWebServicesImplv4_1_custom.php
<?php
if(!defined('sugarEntry'))define('sugarEntry', true);
require_once('service/v4_1/SugarWebServiceImplv4_1.php');
class SugarWebServiceImplv4_1_custom extends SugarWebServiceImplv4_1
{
/**
* #return string
*/
public function test()
{
LoggerManager::getLogger()->warn('SugerWebServiceImplv4_1_custom test()');
return ("Test Worked");
} // test
} // SugarWebServiceImplv4_1_custom
I found the answer to this issue.
In the file {SuiteCRM}/include/entryPoint.php there are many files that are included thru require_once. In this list of require_once files, there were 4 files that were set as require not require_once. These were classes and therefore could not be included a second time. I changed these to require_once and the HTTP Error 500 went away and the custom APIs started working.
I am getting below error while accessing by website having PHP 5.4 version running on REHL-7 with Zend framework as 1.11.11.
Can anyone help in resolving the below issue.
Error::
"Argument 1 passed to Zend_View_Helper_Navigation_HelperAbstract::setAcl() must be an instance of Zend_Acl, boolean given, called in /var/www/html/amov/library/Buza/Controller/Plugin/Navigation.php on line 48 and defined', '/var/www/html/amov/library/Zend/View/Helper/Navigation/HelperAbstract.php', 333"
Code in Navigation.php file:
$view = $layout->getView();
$view->navigation($navigation)
->pikeMenu()
->setACL(Zend_Registry::get('acl'))
->setRoles(Zend_Auth::getInstance()->getIdentity()->getRoles());
Code in HelperAbstract.php file:
public function setAcl(Zend_Acl $acl = null)
{
$this->_acl = $acl;
return $this;
}
The project works in my local environment but when I deploy it on shared web server it doesn't work.
Server
/home
/app
/src
/gestor
/UsuarioBundle
...
/vendors
....
/public_html
/web
app.php
...
If I go to host/app.php ->
Fatal error:
Class 'Gestor\UsuarioBundle\UsuarioBundle' not found in /home/esdrhazc/app/AppKernel.php on line 19
AppKernel.php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Gestor\UsuarioBundle\UsuarioBundle(),
new Gestor\AdministracionBundle\AdministracionBundle(),
new Gestor\ExpedientesBundle\ExpedientesBundle(),
new Gestor\GestionBundle\GestionBundle(),
new \Ideup\SimplePaginatorBundle\IdeupSimplePaginatorBundle(),
new Gestor\MensajeBundle\MensajeBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle()
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
Autoload.php
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/**
* #var ClassLoader $loader
*/
$loader = require __DIR__.'/../vendor/autoload.php';
$loader->add('Gestor', __DIR__.'/../src');
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;
And finally, for instance, class Usuario.php
namespace Gestor\UsuarioBundle\Entity;
...
class Usuario implements AdvancedUserInterface {...}
I have deleted server/app/cache and give permissions.
Thanks in advance!!!
Change the folder 'gestor' to 'Gestor'
I have started learning zend framework. I am using version 1.12. I am using modular approach. I have created one module called 'admin'. Following the my structure of the site
application/
(...other directories)
modules/
admin/
controllers/
IndexController.php
forms/
Login.php
views/
scripts/
(...view scripts)
Bootstrap.php
In this module I have created one form called 'login' using zf tool. whose class is created like this.
class Admin_Form_Login extends Zend_Form
{
public function init()
{
}
}
now the problem comes when I called this form in my admin module's index controller.
class Admin_IndexController extends Zend_Controller_Action {
public function indexAction()
{
$form = new Admin_Form_Login;
}
}
It gives me error like this.
Fatal error: Class 'Admin_Form_Login' not found in E:\xampp\htdocs\novo\application\modules\admin\controllers\IndexController.php on line 13.
I am not sure what I am doing wrong. anybody, please help me.
I think you can do th enext things:
1. Enable autoloading for module's models:
in application.ini:
resources.modules = []
resources.views = []
resources.frontController.moduleDirectory = APPLICATION_PATH . "/modules"
Create form in modules/admin/models/Form/Login.php and call class Admin_Model_Form_Login
Check your module bootstrap. It should be:
class Admin_Bootstrap extends Zend_Application_Module_Bootstrap
I have my view helper in Library/My/View/Helper/LoadSkin.php, I added this line in application.ini : resources.view.helperPath.My_View_Helper = "My/View/Helper" but I'm still getting
Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message
'Plugin by name 'LoadSkin' was not found in the registry; used paths: Zend_View_Helper_: Zend/View
/Helper/;C:/Program Files (x86)/Zend/Apache2/htdocs/TinOuzel/application/views\helpers/'
This looks like ZF stills looks for helper in default path ;/
My namespacje is registered in bootstrap:
protected function _initAutoloader ()
{
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('My_');
$autoloader->suppressNotFoundWarnings(true);
return $autoloader;
}
in this case , you must had overridden the default view object
in much clear example , you are using something like :
$view = new Zend_View();
mostly somewhere in your bootstrap file , just remove it and you would be okay