Reputation: 1613
I am newbie to zend framework and i am trying to configure the zend..
In that process i created some album module.. by following the Zend user-guide
1) I have configured virtual host... as
<VirtualHost *:80>
ServerName zend.localhost
DocumentRoot /var/www/Zend_project/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/Zend_project/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Everything works well when i typed the following Url
http://zend.localhost/
I got the page as below
2) After getting this page i started to create new module Album as per User-guide
I followed every step in user-guide... and created files and folders according to user-guide..
3) Finally i added Album module in application.config.php file
// This should be an array of module namespaces used in the application.
'modules' => array(
'Application',
'Album', // added as new module
),
After adding the module Album to application.config.php
I tried to refresh page with the above successful URL
http://zend.localhost/
I got the error messages as follows
Warning: include(/var/www/Zend_project/module/Album/config/module.config.php): failed to open stream: No such file or directory in /var/www/Zend_project/module/Album/Module.php on line 28
Warning: include(): Failed opening '/var/www/Zend_project/module/Album/config/module.config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/Zend_project/module/Album/Module.php on line 28
Fatal error: Uncaught exception 'Zend\ModuleManager\Listener\Exception\InvalidArgumentException' with message 'Config being merged must be an array, implement the Traversable interface, or be an instance of Zend\Config\Config. boolean given.' in /var/www/Zend_project/vendor/zendframework/zendframework/library/Zend/ModuleManager/Listener/ConfigListener.php:317 Stack trace: #0 /var/www/Zend_project/vendor/zendframework/zendframework/library/Zend/ModuleManager/Listener/ConfigListener.php(127): Zend\ModuleManager\Listener\ConfigListener->addConfig('Album', false) #1 [internal function]: Zend\ModuleManager\Listener\ConfigListener->onLoadModule(Object(Zend\ModuleManager\ModuleEvent)) #2 /var/www/Zend_project/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent)) #3 /var/www/Zend_project/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('loadModule', Object( in /var/www/Zend_project/vendor/zendframework/zendframework/library/Zend/ModuleManager/Listener/ConfigListener.php on line 317
FYI
I am using ubuntu 3.10 operation system
Where i am doing wrong..?
Any help would greatly appreciated..
Upvotes: 0
Views: 1564
Reputation: 666
As "amin arab" said, it can't load the module config, but if somebody is working on Windows (that's my case), I had to go back one folder to make it load correctly, so I changed this:
public function getConfig() {
return include __DIR__ . '/config/module.config.php';
}
to
public function getConfig() {
return include __DIR__ . '/../config/module.config.php';
}
In Module.php
Upvotes: 0
Reputation: 530
this error means is , zend cann't load Album\config\module.config.php
your code has problem in Album\Module.php or Album\config\module.config.php
if your code hasn't syntax error in Module.php and your code has
public function getConfig() {
return include __DIR__ . '/config/module.config.php';
}
on this file something wrong in module.config.php .
please show Album\Module.php and Album\config\module.config.php
Upvotes: 1
Reputation: 1678
May be it is permissions issue, just try to run the following command and see if it works:
sudo chown -R www-data:www-data /var/www/Zend_project
where the www-data is the user of the apache server, if it worked then apache don't have the right to read or write on the files/folders in the project you are working with.
Upvotes: 0
Reputation: 23891
I suggest you using this skeleton for your project. 100% functioning.
http://www.zf-beginners-guide.com/archives.html
Upvotes: 0