Zend Framework 2 - Internal server error in module - php

I just created a module with a submodule like Backend\Entity1. I checked every path and namespace, they all seem to be ok.
I took out codeblocks one by one but stil I just get via Firebug a
"NetworkError: 500 Internal Server Error"
Any ideas what I can do to find the error?
I just don't know what might be wrong. Honestly, why does the framework explain itself what is happening? Its just fishing in the dark now...
BTW: The error.log doesn't show something either...
Edit:
I'm guessing that this error is raised because my app can't find the phtml files. Maybe I'm wrong but usually when I get this kind of silly error it has something to do with missing files...
My config code looks like this:
'view_manager' => array(
'template_path_stack' => array(
'entity' => __DIR__ . '/../view',
),
),
My namespace is MasterData\Entity and my add/edit/delete/index.phtml lie under view\masterdata\entity.
Any ideas how I can tell the TemplatePathStack how to look in this dir for my files?

If your want your sub module to be accessed create proper route in the parent module to make a way to access your sub module.
I IMHO if you need to create sub modules, create as module and place the modules under modules folder of your application, if you have components or third party modules place it under vendor folder.
This would be easier to manage at later stages an your url will also be much simpler

In my case, I created the new model in another way but I had the same error when I tried to see the result in the explorer. The problem (in my situation) was the access to files from the explorer, It resolves by changing files's permissions in linux's terminal.

Related

Zend 2.2 adding new module, page goes blank

I am new to Zend Framework and trying to setup my first module.
Installation goes fine. Everything runs fine i.e. home page and Application module.
Now, Followed all the steps to create Album module but as soon as I add 'Album' module in application.config.php it all goes blank. Home page goes blank as well.
Below is the code I have added.
return array(
'modules' => array(
'Application',
'ZendDeveloperTools',
'BjyProfiler',
'User',
'Album',
),
Can anyone let me know, what I am doing wrong?
Thanks.
When you add the Album module name to the config, the system will attempt to load that module, if any problem exists with that module's base class, it will cause the system to fail with an error. If you have errors turned off then you will not see it, but instead will be presented with a white screen.
check you have errors turned on (error_reporting etc)
make sure you have a class called Module in the Album Namespace.
make sure the Album\Module class is in the module\album\Module.php file
make sure that the code in the Album\Module class does not have any errors in the getConfig method or onBootstrap (if you've added either of those)
Unfortunately without further information on how the module is set up, there is little more we can do to help.

Yii 1.1.16 : components folder is not accessible all over the application in Ubuntu

The error I'm getting is:
include(widgetHomeMenu.php): failed to open stream: No such file or directory
same for all other widget views I'm rendering on other pages.
The file is in my components directory. I guess the directory is not accessible because the file exists there. Plus I've given permission to all the files in /var/www.
Also in my config.php file, there is:
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
),
So, I guess the config is loading components as well.
Not sure where is the problem exactly. No problems with case sensitivity, its correct and the filename is correct as well. The application is working flawlessly on several Windows PC using xampp.
Will be thankful for any help.
I found the problem. It was ultimately related to case sensitivity even though I mentioned above that there was no such problem.
I was loading the widget like this:
<?php $this->widget('widgetDashboardMenu');?>
where I thought that widgetDashboardMenu was the name of the view that was about to render (my bad). This was actually the controller inside components named WidgetDashboardMenu which then loaded widgetDashboardMenu.
So, changing w to W solved the problem for me.
<?php $this->widget('WidgetDashboardMenu');?>

ZF2 Google Maps Module - Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for GMaps\Service\GoogleMap

I'm trying to use this module, https://github.com/gowsram/zf2-google-maps- , but I'm running into a problem.
Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for GMaps\Service\GoogleMap
I have followed the instruction in the github readme, and have cloned the project into my vendors directory.
From what I understand, the line which calls the ServiceLocator,
$map = $this->getServiceLocator()->get('GMaps\Service\GoogleMap');
isn't pointing to the right place. Unfortunately my knowledge of how the service locator works isn't deep enough to figure out how to fix the problem, despite attempts to remedy this by diving into the docs. It's all a little over my head.
Thanks for any input you may be able to provide!
Have you edited your application.config.php file so that the modules array contains GMaps? From the look of the error, the module isn't running since the service is not registered with the ServiceManager.
That step appeared to be skipped over in the installation instructions but you should add it to your application config so it runs the module's Module.php code.
application.config.php
return array(
'modules' => array(
'Application',
'GMaps',
),
/...
);

PHP: Installing minScript extension to Yii Framework

I have been debugging this for quite some time and am unable to find any solution - so this is my last hope.
I am trying to install/configure an extension for Yii called minScript by following this installation guide.
I place the extracted extension in my extensions folder, and change the config/main.php to the following:
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Demo app',
'controllerMap'=>array(
'min'=>array(
'class'=>'ext.minScript.controllers.ExtMinScriptController',
),
),
...
// application components
'components'=>array(
'clientScript'=>array(
'class'=>'ext.minScript.components.ExtMinScript',
'minScriptDebug'=>true,
),
...
Although when I try to run it, I get an error message:
CException
Alias "ext.minScript.components.ExtMinScript" is invalid. Make sure it points to an existing PHP file and the file is readable.
The file exists in the defined folder and is readable, yet the error message always appears.
Anyone have any idea what I am doing wrong?
If your installation is on Linux, be careful with spelling in file and directory names. I wasted a lot of time trying to solve the same problem with views and other components or extensions,
If not, try removing:
'minScriptDebug'=>true,
From your 'components' block.
Also assets and protected/runtime should be writtable (recursively).
Your file structure should look like:
protected/extensions/minScript/
components/
ExtMinScript.php
controllers/
ExtMinScriptController.php
vendors/...
minify/...
And finally maybe you have a trouble with urls, routing rules or with your .htaccess / web server setup. In first case, in config/main.php I use all the urls with format domain.com/site/parm1/parm2 and adding this before routing rules solved the trouble:
'urlManager'=>array(
'urlFormat'=>'path',
EDIT: I forgot this:
'controllerMap' section should be after 'components' in config/main.php,
Good luck!
Try insert before return (you need to declare alias ext - set it on extension directory):
Yii::setPathOfAlias('ext',
dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'extension';

Are there codeigniter controller sub-directory limits?

Greetings,
I've encountered a seemingly bizarre issue, and was wondering if anyone is able to shed a light.
I created a simple controller two levels down from the traditional /application/controllers/ directory and I'm seeing a CI-generated 404 when hitting said controller.
To elaborate, my directory structure is as follows:
/ci/application/controllers/dir1/dir2/myfile.php
The file itself has a simple function with an echo statement. When I move said file up one level such that it is located in:
/ci/application/controllers/dir1/myfile.php
It works.
I've tried changing the name of the "dir2" directory in the example above, the name of the controller, the names of the functions within the controller -- to no avail. I'm able to hit the same php file without going through the Code Igniter framework, and I'm on a Windows machine working normally so I can't imagine this to be a permissions-related issue.
I'm led to think that CI simply isn't willing to go into the controllers directory more than one level. Is this possible, or am I missing something?
Try this out: http://glennpratama.wordpress.com/2009/10/20/multi-level-subfolder-for-controller-in-codeigniter/
Basically, you need to override the default codeigniter router with your own MY_Router class
"Out of the box", Codeigniter only supports a single level directory structure for Controllers.
There are ways to extend the default Router class to enable this feature.

Categories