问题描述:

I'm just setting up my test environment, a few questions.

  • I'm using MAMP, should my document root be pointed at the htdocs folder within MAMP?
  • MAMP currently uses the php.ini file that's in .:Applications/MAMP/conf/php5/php.ini, how do I get it to use a php.ini that's in my /var/www/projectname/ folder?
  • I'm getting the following error, is it simply because I don't have any controllers setup?

    Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/include/Zend/Controller/Dispatcher/Standard.php:241 Stack trace: #0 /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/include/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/htdocs/index.php(7): Zend_Controller_Front->dispatch() #2 {main} thrown in /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/include/Zend/Controller/Dispatcher/Standard.php on line 241

Any smart noggins willing to lend a hand?

EDIT:

This is my httpd.conf which is in my var/www/proj folder

<VirtualHost *:*>

ServerName localhost

DocumentRoot /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/htdocs

<Directory /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/htdocs>

AllowOverride All

Options All

</Directory>

php_value include_path .:/Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/include:/usr/local/lib/pear

php_value magic_quotes_gpc off

php_value register_globals off

</VirtualHost>

That doesn't work though, so in my php.ini file I have the following:

include_path = ".:/Applications/MAMP/bin/php5/lib/php:/Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/include"

But I don't want to do it that way, I want to be able to use httpd.conf. Are these just two methods of achieving the same thing?

网友答案:

This error is thrown because an error occurs in your bootstrap (index.php line 7) when trying to dispatch a request, and additionally you don't have an ErrorController defined.

Create a controller alongside your IndexController called ErrorController in file ErrorController.php

The ZF Reference guide has a section on the ErrorController (scroll down a little for code)

This should at least allow you to use the ErrorController to display the root cause of the problem!

网友答案:
  1. Honestly I don't remember because I use MAMP PRO. In MAMP PRO (and MAMP as far as I remember) you'll be able to change your document root. In MAMP PRO (only) you can create several virtual hosts.

  2. Instead of pointing MAMP at another file, edit the MAMP one, because MAMP does some changes to the file so that you have greater flexibility. Try having a look at File > Edit Template > PHP5 php.ini

  3. You haven't created any controllers in your Zend Framework installation. Because there is not exception catching set up pr. default, you're given a "Fatal error: uncaught exception" error.

In the hope that my answer was helpful.

相关阅读:
Top