Debugging Zend Framework in Eclipse, mod_rewrite problems - eclipse

I have a simple ZF that already works well.
I've set it up to work in a subfolder, so I access it with localhost/zftutorial URL.
Now the time came for debugging, but when I execute debugger in Eclipse, it appends debug URL params (like XDEBUG_SESSION_START=ECLIPSE_DBGP) which break everything and I start getting this message:
> Zend_Controller_Dispatcher_Exception: Invalid controller specified (index.php) in C:\Program Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Dispatcher\Standard.php on line 241
I've tried to set both localhost/zftutorial and localhost/zftutorial/public/index.php as start URLs for debugger, but still getting the same message.
Looks like ZF likes clean URL names, but Eclipse wants scripts with php extensions, but controller names. Whichever debug options I use, Ecplise tries to start debugging from
not Zend-style URL - http://localhost/zftutorial/index.php
I guess this can be solved 2 ways:
configuring Eclipse somehow to use a proper URL with debug params, like localhost/zftutorial
setting rewrite rule for localhost/zftutorial/public/index.php to be rewritten as localhost/zftutorial (right?)

I've come to a conclusion that such problems are best avoidable by setting up ZF application
public folder as root folder in web server. Such root placement is a recommended practice and causes are no debug-related problems like above, unlike when ZF app resides in a subfolder and mod_rewrite rules break things now and then.

Related

Zend A 404 error occurred Page not found

I am new to zend frame work. I am in the process of learning this, in fact at the very beginning of this. My problem is that I download the zend studio and try to run the zend application by following a tutorial on net but the when I run the code it said that
'A 404 error occurred
Page not found The requested URL could not be matched by routing '.
I googled man time and applied all the possible solutions on it but all in vein. Kindly help me in this regard.
To Do list:
check your server folder permission -> 777 for the development
check .htaccess file in the public folder, there is a good example .htaccess files for Zend in here stackoverflow
check your php configuration for model rewrite, unlikely sometimes it does not install
check your apache site-enable file for model rewrite and allowaccess
you need to google them out, but that is it, after you finish your first one , all other project just copy from the first one

The Web server is configured to not list the contents of this directory

Using Visual Studio 2012:
I created an "ASP.NET Empty Web Application" (using C#).
I used NuGet to install the FubuMVC package.
When I run the application (using IIS Express), I get the "Welcome to FubuMVC!" page which tells me to delete the FubuMVC.GettingStarted.dll file and to set the home page.
So I do both of those things, implementing a HomeController that simply returns "Hello World" from Index.
Rather than the expected "Hello World", I get an IIS error: The Web server is configured to not list the contents of this directory.
What have I done wrong?
try this
cmd => don't forget to run as administrator
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir
Just tried reproducing your problem with a brand new project; it turns out that problem is that the instructions in the example haven't kept up with the changes in FubuMVC.
The instructions tell you to create a class called 'MyHomeController' and add the Index() method to it. This used to work, because one of the default rules for routes was to use any class with a name that ends in 'Controller'.
But the default has been changed in more recent versions, and the rule now looks for classes ending in 'EndPoint'.
So if you change the name of the class from 'MyHomeController' to 'MyHomeEndpoint', it should work.
Also, remember that the application pool needs to restart for the new configuration to take effect, so you might have to touch your web.config (or force IISExpress to restart).
Did you activate FubuMVC in your Global.asax? I usually see that error when there is no FubuMVC application.
So in Application_Start() (or whatever it's really called), you'll need something like:
FubuApplication.DefaultPolicies().StructureMap(new Container()).Bootstrap();
Where you're telling it:
1.) What are the policies/conventions to use
2.) What's your IoC container
Usually if I run into this it's because I've got a conflict with a route and a folder in the project. For example, I might have a folder called 'Unit' and inside it I have a class called 'UnitEndpoint' with a method 'get_unit' (which should map to '/unit' as a route, assuming I'm using the FubuMVC defaults).
In that case, browsing to '/unit' will result in this error because IIS thinks I'm trying to list the contents of the 'Unit' folder. Renaming the endpoint or the folder to remove the conflict will fix it (e.g., renaming the 'Unit' folder to 'Units').
I suggest that you recompile your application or at least touch your global.asax -- looks like you need to rerun the App_Start method.

Need help setting up a (Tomcat) web app in Eclipse for debugging

I've been using both eclipse and tomcat for years but have always deployed my web apps externally and never had a problem. Now I'd like to use eclipse to debug my web app and I can't figure out how to make it work. I started by trying to get my existing web app to deploy through eclipse but after hours of trying different things I decided to start fresh. Unfortunately, I didn't get much further. I'm hoping if I can figure out how things work with a fresh webapp I can get things to work on my existing. Sorry, this will be long, but here are the steps I tried on the latest eclipse (Juno):
Installed new version of tomcat 7.0.34 at /usr/java.
In eclipse, used "servers" view to add server, pointing to the new install (I didn't add any resources because there weren't any available yet). Starting the server worked and got a 404 as expected at http://localhost:8080/ ... then I stopped it.
Created a new "dynamic web project", named it TomcatDebug, set the location to ~/tomcat-debug, chose the server just created above (the only one), chose default config, tomcat-debug is empty so chose defaults for build paths, defaults for module settings and had it generate web.xml.
In the "tomcat-debug" folder it creates WebContent, build, and src. I throw a sample "hello, world" index.html into WebContent.
Now the project TomcatDebug is created so I try to run it, tell it to "run on server", and it goes to http://localhost:8080/TomcatDebug/ but gives a 404. I even try to add index.html but it still gives a 404.
This is about as basic as it can possibly get so what did I do wrong?
Continuing to try and figure this out I stop the server, change the server setting to "use tomcat installation", but still get a 404 in the same way when I restart. I tried changing my module context path and still 404.
I'm completely stumped. I believe I followed all the wizards as basically as possible. Where did I go wrong?
Thanks for taking a look.
I haven't run tomcat through eclipse in a while, so can't answer that aspect of the question. But, to get at the heart of what you're trying to do (debug a webapp in eclipse through tomcat), you shouldn't necessarily need to. This may serve you instead:
EDIT: Eh, look here for instructions ("Debugging" section). The below is how I did it (JUNO and TC 7) and has an annoying quirk in point #1.
edit the startup.sh (assuming *NIX/OS X) - the last line will probably be
exec "$PRGDIR"/"$EXECUTABLE" start "$#"
change this to
exec "$PRGDIR"/"$EXECUTABLE" jpda start "$#"
to activate debugging. (there are other ways to do this that may be better - i think tomcat/the VM may pause for listeners before proceeding, so when you aren't debugging this is not ideal)
Create a Debug Configuration in eclipse, under the "Remote Java Application" set. Default port should be fine, and presumably host. Choose your project.
Add sources of relevance to your debugging in the Source tab.
Start server and run your new debug configuration. App should stop at breakpoints you've set.
Right Click your index.html Run As -> Run On Server you will see Tomcat will automatically run the page.

gwt module does not load on gae

on a particular page on our site http://www.sakshum.org/ui/page/JoinUs.jsp which is build using gwt and deployed on GAE the module does not load.
This works fine in development env in eclipse and have no errors when looking via firebug in the console.
Please advise what may be wrong here and how to fix it?
look at the AE logs. firebug will only show you client side stuff. It's probably a classpath issue -- such as you have something locally but aren't uploading that jar ...etc.
Edit:
please post your JoinUs.jsp
I am calling my gwt module via a jsp page on AE no problem. Maybe the path in your script tag pointing to the *.nocache.jsp file is off somehow. Usually when things resolve locally but not on AE, for me, the problem was appengine-web.xml and setting include and exclude paths. I had to be careful there because things worked differently locally and deployed - especially using wildcard.
Also, look for uri errors under the dashboard (ae administration page). static resources that are not found will show there and not in the ae log since they are static.
Thanks all for the help. So, the issue was completely different. Actually the div tag was not rendering at all due to the coding error of a if statement in the jsp. On fixing that it started working

What should I configure when I put Zend project on windows to Ubuntu Lamp?

What should I configure when I put Zend project on windows to Ubuntu Lamp?
(I asking that beacause my Zend progect not working on Ubuntu, its gives first pages, but after i enter to next page its gives me 404 error(page Not Found), I check if rewrite mod enable with : sudo a2enmod rewrite and get: Module rewrite already enabled ::: I dont have such probelm on Zend Ce and Wamp servers on Windows).
Thanks,
Yosef
It almost sounds like the .htaccess file is not being taken into account. As a test you could try route this through index.php manually such as:
http://localhost/controller/action -> http://localhost/index.php/controller/action
This might help to narrow it down.
Double-check your class file names. Windows is a little more forgiving on case-sensitivity issues. It's quite easy to break an application written on a PC and transferred to a LAMP box with the wrong camel-casing on class files. I learned that the hard way.