tags:

views:

507

answers:

2

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 );

A: 

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.

fireeyedboy
.htaccess looks right, but just in case, I changed it back to /index.php and then dumped everything in the root. I got the same result. 404
RepDetec
Did you remove the `setBaseUrl( /* path */ )` call, as described in the blog entry you referred too, again also?
fireeyedboy
To eliminate possible further confusion, can you post the contents of `.htaccess`, the defition of the (virtual) host, and the absolute location of the `public` folder in your question? I think we can tackle the problem more easily then.
fireeyedboy
fireeyeboy, I did not do anything with the "setBaseUrl" call from the blog. I could not find this method in the bootstrap file or anywhere else. For the .htaccess contents and the absolute location of the public folder, please see above. Thanks for the help!
RepDetec
So, I found the "setBaseUrl" method in the FrontController.php file. I commented it out, but still get a 404Line://$front->setBaseUrl($value);
RepDetec
FrontController.php is not the place to edit this, since this is a library file (I believe). See my edited answer above. You should define your baseUrl in your bootstrap.
fireeyedboy
Where do I put this stuff in the bootstrap?If I put:$front = Zend_Controller_Front::getInstance();in _initAutoload, the app just hangs.
RepDetec
Alright, try this then. Put the following in your `application/config/application.ini` file:`resources.frontController.baseUrl = "ZendFrameworkQuickstart/public"`
fireeyedboy
Also, be sure you have display errors set to on, on your test server. This will give you valuable error info, in stead of a blank screen when your app hangs. To do so, put this at the top of your index.php file:`error_reporting( E_ALL | E_STRICT ); ini_set( 'display_errors', 1 );`
fireeyedboy
Sorry, `resources.frontController.baseUrl = "ZendFrameworkQuickstart/public"` should be `resources.frontController.baseUrl = "/ZendFrameworkQuickstart/public"` (note the first slash)
fireeyedboy
Ok, so adding the resources.frontController.baseUrl = "/Zend..."prevents the app from just spinning and hanging on the "Welcome Screen"However, http://localhost/ZendFrameworkQuickstart/public/guestbook still gives a 404I put key lines in the post above just in case you see something wrong with them. Thanks
RepDetec
A: 

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!

RepDetec