3
votes

All,

I am just trying to view any page at all besides the “Welcome to Zend Framework” screen.

I have downloaded the project from this tutorial: http://framework.zend.com/docs/quickstart/create-a-form (Zend Framework Quickstart)

As far as I can tell, the paths are coming up correctly. I read this post: http://www.johnmee.com/2008/11/zend-framework-quickstart-tutorial-deploy-to-a-subdirectory-instead-of-web-root/ I think it may be a bit dated, as the bootstrap code is not as he describes.

Does anyone have any ideas? I would think that the tutorial download from Zend should work out of the box.

Summary: http://localhost/ZendFrameworkQuickstart/public/ Displays: Zend welcome page

http://localhost/ZendFrameworkQuickstart/public/guestbook Displays: 404

Thanks!

UPDATE Physical path of the “public” directory: C:\Zend\Apache2\htdocs\ZendFrameworkQuickstart\public

URL I’m hitting from the browser: http://localhost/ZendFrameworkQuickstart/public/guestbook

.htaccess Contents:

SetEnv APPLICATION_ENV development

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ /ZendFrameworkQuickstart/Public/index.php [NC,L]

UPDATE: Changed lines in files

.htaccess RewriteRule ^.*$ /ZendFrameworkQuickstart/public/index.php [NC,L]

application.ini resources.frontController.baseUrl = "/ZendFrameworkQuickstart/public"

public/index.php error_reporting( E_ALL | E_STRICT ); ini_set( 'display_errors', 1 );

2
is guestbook actually a directory under public, or is the public directory using mod_rewrite ??Jacob Relkin
No, guestbook is not a directory under public. I have mod_rewrite turned on in the apache config. Do I also need some kind of config inside of public?RepDetec
You have a typo in the last RewriteRule of .htaccess: apache is case sensitive, so Public should be public. Be sure to uncomment //$front->setBaseUrl($value) again.Decent Dabbler
Hmm, forget what I said about case sensitivity, turns out not to be true (at least not on my Windows box). My apologies. If the setBaseUrl() in the bootstrap won't do it, then I'm afraid I'm out of ideas.Decent Dabbler

2 Answers

2
votes

Finally figured it out. In the httpd.conf file for Apache, change every instance of "AllowOverride None" to "AllowOverride All."

I'm not sure why Zend didn't have this setup already, since my Zend Framework install setup Apache. After this change, the Quickstart ran as-is (and didn't even need to be in the root).

Thanks for all of the help!

0
votes

Adding to Jacob's comment: I think the mod_rewrite conditions and rules in the .htaccess file for the Quickstart application expect everything to be relative to the root of the domain and particularly rewrites everything to the root of the domain (/index.php to be specific).

So either:

  • adjust the rewrite conditions and rules in the .htaccess, or
  • let the root of the (virtual) host point directly to the public folder of the Quickstart application.

Also, be sure you have mod_rewrite enabled on your server (assuming you have an apache server).

EDIT Since your application is not running from the root of your server you should probably still set the baseUrl somewhere in your bootstrap. With something like:

$front = Zend_Controller_Front::getInstance();
$front->setBaseUrl( '/ZendFrameworkQuickstart/public' );

But you'll be saving yourself a lot of trouble to just circumvent this by putting your application in the root of your server, or let the root of your server point to the public folder in httpd.conf, if either of these options is available to you.

If you do this, be sure to put the .htaccess to it's default settings again.