zend framework: Creating the Default Module - zend-framework

I did everything as it is written in the book of Vaswani V. - the Zend Framework. A Beginner's Guide (page 33), but the page "http://square.localhost/default/index/index" returns the response "not found". What is wrong?

I had the exact same problem with that part of the book. Fortunately, the book's companion site (zf-beginners-guide.com) has an errata/troubleshooting section that solves the problem nicely. Quoting from the site:
If you see a "File not found" error after implementing the modular
directory layout and accessing the URL
http://square.localhost/default/index/index, check that the new
virtual host supports .htaccess overrides. You can enable this by
adding the following lines to your virtual host configuration,
remembering to change the directory path to your virtual host's
document root.
<Directory "/usr/local/apache/htdocs/square/public">
AllowOverride All
Options All
</Directory>
Incidentally, if you're using Ubuntu, it may not have mod_rewrite enabled by default. (I just ran into the exact same problem myself BTW). If you're still having trouble, try this:
sudo a2enmod rewrite
sudo service apache2 restart
(Big thanks to Mahok for the help on that, BTW!)

Related

Bugzilla REST API produces only a 404 error

I have Bugzilla installed on Windows 7, Apache 2.4. It is accessible at: http://localhost:80/bugzilla/ which means when I type that address in my browser, I see the bugzilla homepage, I can login as admin and everything is fine.
I read in Bugzilla's documentation that Bugzilla has a "native REST API" that can be used to interact with it. For example it is alleged that sending a GET to the address: /rest/version will return the version of the installed bugzilla; The problem is, it doesn't!
I construct a request like: http://localhost:80/bugzilla/rest/version and I get a 404 not found error. I get this exact result for "any" request out of the rest documentation examples.
What am I missing? What am I doing wrong?
Incidentally, checksetup.pl shows that my installation is missing these 3 packages:
perl-ldap
mod_perl
Apache-SizeLimit
Could this be the cause?
Update 1: perl-ldap (Net::LDAP) installed. But cheksetup.pl still shows it as not installed and the problem still exists.
Update 2: LDAP installed but the problem still exists :(
My bugzilla installation also retuns "404 not found".
I had to use this URL to work ok: http://localhost:80/bugzilla/rest.cgi/version
Bugzilla installation comes with a default .htaccess file that does the rewrite work:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteOptions
inherit RewriteRule ^rest/(.*)$ rest.cgi/$1 [NE]
</IfModule>
All I had to do: "a2enmod rewrite" and "service apache2 restart" to enable the apache module, then the URL "website/rest/version" works ok.
I found a simple solution,
inside the rest API link you have to replace /rest/ to /rest.cgi/
example: The REST API for getting the details of bugs.
==> http:your bugzila ip/rest.cgi/bug (this rest.cgi syntax work perfectly)

Zend Framework routes not working

I'm having a problem with my Zend Framework application. It was working just fine on my old server, but I've moved it to a new server and for some reason it's no longer working.
If I go to the site's address, I get the main page. But when I try any of the links, I get a 404 error from Apache itself--not from the Zend Framework error controller.
I just set this new server up, and it's likely I've forgotten something, but I have no idea what it is. I don't do a lot of server administrative work, so I don't even know where to begin.
check your apache httpd.conf need allow override:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
I think you need to check document root ways on new server, your index.php is in public folder ?

How do I set a canonical uri on jetty and redirect www users to non www address?

This has been bugging me for some time now, I will greatly appreciate the solution.
I am currently using jetty (jetty-7.3.0.v20110202) to host a static site. I intend to host applications written using JRuby there in the future. I picked Jetty in the first place because someone somewhere told me it had a low memory footprint. I am open to suggestions.
I want to redirect users to a canonical address a-la Redirect non www version of domain to www in Jetty
The method outlined above just doesn't work for me and I have no idea why.
I want my canonical address to be http://example.com/ and any visitors to http://www.example.com/ to be SEO friendly redirected.
I just want to use jetty xml files for the configuration.
I say the jetty documentation is lacking, but I'm not a java programmer, so I'm probably wrong.
I managed to fix this, following the guide included in the link included in the question.
The thing that was not indicated was that it is imperative that you include a virtualhosts section in your site.xml file.
It is commented out by default in the test.xml file example and most definitely needs to be uncommented to work in your site!

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.

Debugging Zend Framework in Eclipse, mod_rewrite problems

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.