install CakePHP on Mac osx: apache problems

爱⌒轻易说出口 提交于 2019-12-18 18:32:42

问题


First time cake user and I'm having real apache problems. For some reason the .htaccess is trying to find

File does not exist: /Library/WebServer/Documents/Users

but there is no such directory as Users. I have tried setting up the following also:

/etc/apache2/extra/httpd-vhosts.conf

<VirtualHost *:80 >
DocumentRoot "/Users/username/Sites/mysite/app/webroot"
ServerName mysite.dev
ServerAlias www.mysite.dev mysite.dev *.mysite.dev
<Directory "/Users/username/Sites/mysite/app/webroot">
    Options Indexes FollowSymLinks
    AllowOverride All
</Directory>
</VirtualHost>

/etc/hosts

127.0.0.1   mysite.dev

/etc/apache2/users/username.conf

<Directory "/Users/username/Sites/">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

That also hasn't worked, but with a different error Failed opening required 'cake/libs/cache/file.php'

Although I'd rather not use virtual hosts, and just run it off localhost


回答1:


Seems like the solution that worked for me was to edit /etc/apache2/users/username.conf and add this at the top:

DocumentRoot "/Users/username/Sites"

And the default cakePHP download now runs ok.




回答2:


Looks like Apache is trying to find your webroot in a different location--the default location, if memory serves. If you want to use virtual hosts (which would be my recommendation, for whatever it's worth), ensure that the NameVirtualHost directive is uncommented. By default, it's commented out:

NameVirtualHost *:80

If you'd prefer not to use virtual hosts for whatever reason, ensure that the NameVirtualHost is commented out (your <VirtualHost> blocks will be ignored) and change the DocumentRoot value to the proper directory:

DocumentRoot "/Users/username/Sites/mysite/app/webroot"

That should tell Apache to look in the right place.




回答3:


I was on the bakery earlier, and noticed this article, which would fit this question perfectly.

http://bakery.cakephp.org/articles/view/installing-cakephp-on-macos-x



来源:https://stackoverflow.com/questions/2486625/install-cakephp-on-mac-osx-apache-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!