zend framework controller not found? - zend-framework

I downloaded the latest version of Zend framework, added a controller and I
can not get it to load.. Here is what I did:
C:\zend\Apache2\htdocs>zf create project myproject
Creating project at C:/zend/Apache2/htdocs/myproject
Note: This command created a web project, for more information setting up your V
HOST, please see docs/README
C:\zend\Apache2\htdocs>cd myproject
C:\zend\Apache2\htdocs\myproject>zf create controller mycontroller
Note: The canonical controller name that is used with other providers is "Mycont
roller"; not "mycontroller" as supplied
Creating a controller at C:\zend\Apache2\htdocs\myproject/application/controller
s/MycontrollerController.php
Creating an index action method in controller Mycontroller
Creating a view script for the index action method at C:\zend\Apache2\htdocs\myp
roject/application/views/scripts/mycontroller/index.phtml
Creating a controller test file at C:\zend\Apache2\htdocs\myproject/tests/applic
ation/controllers/MycontrollerControllerTest.php
Updating project profile 'C:\zend\Apache2\htdocs\myproject/.zfproject.xml'
C:\zend\Apache2\htdocs\myproject>
Then I tried to hit the controller from the browser..
http://localhost/myproject/public/mycontroller/
and I get the error: Not Found
The requested URL /myproject/public/mycontroller/ was not found on this server.
I have no idea how to resolve this, and I'm sort of shocked I'm having problems
with the Zend Server.

Dooh.. Actually the problem was quite simple.. I forgot the mod_rewrite.. Strange Zend didn't turn it on by default.

Check out the Zend Quick Start. It looks like you don't have the document root setup properly. Your request should have been http://localhost/myproject/mycontroller or http://myproject/mycontroller - if setup properly.

Related

API Controller Routing in .NET 6 Doesn't Work Any More

I'm trying to create a standard WebAPI project in .NET 6. I notice that the standard ApiController route doesn't have the leading api route that I like to have. When I add it, the controller breaks. It doesn't give me a 404 (not found), it just gives me that index page that says that I have to enable javascript. I'm really at a loss at what I have to do to make my app work where I can put api at the start of my routes:
[Route("api/[controller]")]
I've tried adding it to the default controller route map in different combinations. I've tried adding the UseEndpoints method in the Program class. I'm just not sure what to differently in 6.
For those who want to "see my code", I'm just using the standard WebAPI project w/ React (NO Redux!).
Check the new setupProxy.js file image description inside the ClientApp folder, you need to configure the backend routes in the proxy config, I had a similar issue with the ASP.NET Core 6.0 with Angular project template, you can find more information here link 1 link 2

does implementing grails rest controllers needs changes in the UrlMappings?

I am trying to imeplement a rest controller in grails 2.3.7. I have a simple controller, same actions as of a scaffolded one, nothing special.
My problem is I am not able to call show, update, delete and save actions via:
GET to localhost:8080/proj/domain/1
PUT/DELETE to localhost:8080/proj/domain/1
POST to localhost:8080/proj/domain
However it works when I add this to the url in UrlMappings.groovy
"/$controller/$action?/$id?(.$format)?"{
action = [POST:"save",GET:'show',DELETE:"delete"]
}
Im following with the grails doc's '8.1.5 Implementing REST controllers'. Based on my understanding of it, it should work without doing further configurations outside of the controller. Is modifying the url mappings necessary?
Yes adding a REST controller requires you to add a URL mapping for the resource, defining it as either singular or multi resource. Example:
“/foo”(resource:”foo”)
Or
“/foos”(resources:”foo”)
You can run url-mappings-report to see the URL mappings this produces

Zend/Controller/Action.php file missing

I'm new to Zend framework, and was trying out the Guestbook tutorial that Zend has on it's web site. I have the latest framework downloaded and setup properly; php.ini include_files has the library location set correctly. In the Guestbook tutorial, the GuestbookController extends Zend_Controller_Action and that's what I typed, but I keep getting error stating that Zend_Controller_Action is not found. Turns out, the folder Controller is missing from /library/Zend. I tried re-downloading Zend Framework thinking I might have accidentally deleted it, but it's not in the newly downloaded framework directory either. So, where can I get the Controller folder that contains all the required class files? Or how can I fix the issue? Any help is much appreciated.
Thanks
Kuni
It sounds like the tutorial you are following is for ZF1. ZF2 was released last year and works quite differently. You might want to try the quickstart from the current manual instead:
http://framework.zend.com/manual/2.0/en/user-guide/overview.html
Alternatively you can still download version 1.12 from the Zend site.

playframework scala - cannot find controllers.Application

As a test project to try out scala I've installed Play framework with the Scala module, following the instructions provided here:
http://scala.playframework.org/
The project gets created fine, but when I go to the home url I get a warning saying the server cannot find the default controller. I've not modified anything from the default install at this point, so my controller looks like this:
package controllers
import play._
import play.mvc._
object Application extends Controller {
def index = Template
}
Any ideas on what am I missing?
Controllers are called action generators. By default the template name will be resolved from the action method name. So if the controllers.Application.index method returns a Template, the app/views/Application/index.html template will be rendered.
Also try cleaning up and re-running the app, sometime it escapes the file updates.
Have a look here http://www.playframework.org/modules/scala-0.9/controllers

MVC2 Areas and Controller 404

My project namespace is
MyProject.MVC
So my controllers, which are segregated into Areas, are in this namespace:
MyProject.MVC.Areas.AreaName
But when I try to access a controller action in this namespace, I get a 404 error:
http://MySite/AreaName/Action/View
If I "remove" the MVC portion from the namespace on my controllers, everything works correctly.
MyProject.Areas.AreaName
Could I have things wired incorrectly or is this an issues with MVC2 Areas?
MyProject.Areas.AreaName is the default namespace used when you start a new project.
I think you have changed your namespaces but forgot to do so on some places.
Try to search your whole solution for MyProject.Areas.AreaName and if you find one, replace it with your MyProject.MVC.Areas.AreaName.
For example look if your AreaRegistration is in the right namespace.
I'm working on a MVC2 project myself with even more complex namespaces and they work, so i think you have an error in your project.