MAMP:主机设置问题
我只是设置我的测试环境,几个问题。
- 我正在使用 MAMP,我的文档根目录应该指向 MAMP 中的 htdocs 文件夹吗?
- MAMP 当前使用 .:Applications/MAMP/conf/php5/php.ini 中的 php.ini 文件,如何让它使用 /var/www/projectname/ 文件夹中的 php.ini?
我收到以下错误,这只是因为我没有设置任何控制器吗?
致命错误:在 /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/include/Zend/Controller/Dispatcher/Standard.php 中未捕获异常“Zend_Controller_Dispatcher_Exception”,并带有消息“指定的控制器无效(错误)” :241 堆栈跟踪: #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} 抛出在 /Users/kieransenior/ 中Development/reformsoft_dietron/trunk/var/www/dietron/include/Zend/Controller/Dispatcher/Standard.php on line 241
任何聪明的头脑愿意伸出援手吗?
编辑:
这是我的 httpd.conf ,位于我的 var/www/proj 文件夹中,
<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>
但这不起作用,所以在我的 php.ini 文件中我有以下内容:
include_path = ".:/Applications/MAMP/bin/php5/lib/php:/Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/include"
但我不想那样做,我希望能够使用httpd.conf。 这只是实现同一目标的两种方法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
抛出此错误是因为尝试分派请求时引导程序(index.php 第 7 行)中发生错误,而且您没有定义 ErrorController。
在文件 ErrorController.php 中与 IndexController 一起创建一个名为 ErrorController 的控制器
ZF 参考指南有一个关于 ErrorController(向下滚动一点代码)
这至少应该允许您使用 ErrorController 来显示问题的根本原因!
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!
老实说我不记得了,因为我使用的是 MAMP PRO。 在 MAMP PRO(以及我记得的 MAMP)中,您将能够更改文档根目录。 (仅)在 MAMP PRO 中,您可以创建多个虚拟主机。
不要将 MAMP 指向另一个文件,而是编辑 MAMP 文件,因为 MAMP 会对文件进行一些更改,以便您拥有更大的灵活性。 尝试查看“文件”>“ 编辑模板> PHP5 php.ini
您尚未在 Zend Framework 安装中创建任何控制器。 因为没有异常捕获设置pr。 默认情况下,您会收到“致命错误:未捕获的异常”错误。
希望我的回答有帮助。
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.
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
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.