views:

49

answers:

4

When I try to access the url http://localhost/mysite/public/images/grey-arrow.gif in a controller in my application I get the error:

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (images)' in C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 C:\xampp\php\PEAR\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 D:\Users\rnem\www\mysite\application\Bootstrap_Aplicativo.php(64): Zend_Controller_Front->dispatch() #2 D:\Users\rnem\www\regnet3.0\home\index.php(3): include_once('D:\Users\rnem\w...') #3 {main} thrown in C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php on line 242

Why is it thinking images is a controller instead of a folder as it is?!

+2  A: 

What do you have in your .htaccess file in /public?

Chris
Indeed, this happens when your RewriteRules either match all requests, or match requests that don't correspond to a file on disk
David Caunt
A: 

This is what I have

# Rewrite rules for Zend Framework
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

# Security: Don't allow browsing of directories
Options -Indexes
Roger Nem
And does the file exists?
Chris
A: 

I think you might need to access your site via a virtual host configuration, instead of just path-ing out via localhost. I suspect the URL re-writer can't find your image file because it doesn't know that public is the root directory files are served from, so it falls back on trying to interpret the URL as a controller action.

Creating a virtual host is covered in the Zend Framework Quickstart

Bryan M.
A: 

The default htaccess for zend is:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

Give that a go. If that doesn't work the vhosts mentioned above should be:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/Users/rnem/www/mysite/public
</VirtualHost>

Put that into your vhosts conf file, remember to uncomment the vhosts line in your httpd.conf. This might help, http://www.tildemark.com/software/servers/setting-up-virtual-hosts-with-xampp-running-on-windows-xp.html, otherwise there's plenty of giudes on google

Ashley

related questions