Reputation: 9956
I am moving a Zend framework project to a new server. The project was built by another developer and uses Doctrine, which I have not used myself so I am a bit lost as to fix the error.
I have run some other zend projects on the target server (running ubuntu 14.04) without issue but with this project I get a Doctrine DBAL exception.
The error I am getting is:
Fatal error: Uncaught exception 'Doctrine\DBAL\DBALException' with message 'The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection().' in /projectpath/library/Doctrine/DBAL/DBALException.php:60 Stack trace: #0 /projectpath/library/Doctrine/DBAL/DriverManager.php(173): Doctrine\DBAL\DBALException::driverRequired() #1 /projectpath/library/Doctrine/DBAL/DriverManager.php(136): Doctrine\DBAL\DriverManager::_checkParams(Array) #2 /projectpath/www/toolbox/library/Doctrine/ORM/EntityManager.php(938): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\ORM\Configuration), Object(Doctrine\Common\EventManager)) #3 /projectpath/www/toolbox/application/Bootstrap.php(151): Doctrine\ORM\EntityManager::create(Array, Object(Doctrine\ORM\Configuration)) #4 /projectpath/www/toolbox/library/Zend/Application/Bootstrap/BootstrapAbstract.php(669): Bootstrap->_initDoctrine() #5 /projectpath/www/toolbox/library/Zend/Application/Bootstrap/BootstrapAbstract.php(622): Zend_Application_Bootstrap_Boo in /projectpath/www/toolbox/library/Doctrine/DBAL/DBALException.php on line 60
Upvotes: 0
Views: 1923
Reputation: 44356
In your Zend Framework 2 project there is an autoload
folder.
\config\autoload
In this folder you should make all the appropriate *.local.php
files with the configuration options for your new server (where you migrate the project to).
One of them is for doctrine and should contain something like this:
<?php
return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'localhost',
'port' => '3306',
'user' => 'username',
'password' => 'password',
'dbname' => 'database',
'charset' => 'utf8',
)
)
)
)
);
Read more on configuration of your application in the ZF2 documentation
Upvotes: 1