dongwo5589 2015-08-18 00:19
浏览 57
已采纳

CakePHP 3 Apache没有找到Views

I am just starting to work with CakePHP3.0 and while following the 'Quick Start Guide' I came across a step that has me stuck.

The section labeled DATABASE CONFIGURATION has me create some MySQL tables (I copy pasted from the site) and then run the commands: bin/cake bake all bookmarks, bin/cake bake all users, and bin/cake bake all tags.

After running those three commands several files have been generated; the Models and Controllers associated with the tables I just created. However, the Views have not been created...By the way I am using Ubuntu 12.04

As suggested by the tutorial I checked my apache2/mods-enabled directory for the rewrite.load and it is there.

Has any else experienced this issue? It is likely that I am making a simple mistake

This is the output when I ran bin/cake bake all bookmarks the first time: enter image description here enter image description here

As the tutorial suggested, if I receive a 404 page not found error I should make sure that mod_rewrite is enabled for apache2, also I noticed that it says to use http://localhost:8765/bookmarks since my web server is configured on port 80 I have been ignoring the port # suggested by the tutorial.

Here is a screenshot of my apache2/mods_enabled/: (rewrite.load is present) enter image description here

Lastly, here is the data source that I have configured in /config/App.php: enter image description here

It is beginning to appear that the problem is with my Apache configuration and the rewrite rules. I will investigate into this further.

  • 写回答

1条回答 默认 最新

  • dongxian4531 2015-08-18 18:50
    关注

    Turns out that I was initially confused about what CakePHP3 was supposed to create and realize now that it was running as expected (see question above for output). One the proper DocumentRoot is set, if rewrite is not set up properly navigating to you page may begin a download of the file you mean to view instead.

    The real problem was with my Apache configuration. These are the steps I followed to configure Apache 2.4 (after reinstalling Apache):


    1. Add the new DocumentRoot in /etc/apache2/sites-available/000-default.conf and in /etc/apache2/sites-enabled/000-default.conf

    2. Enable mod_rewrite: a2enmod rewrite

    3. Restart Apache: service apache2 restart


    After enabling rewrite your /etc/apache2/mods-enabled/ may look like this(notice rewrite highlighted): rewrite_enabled Problem has been resolved. Thanks to this post!

    @user1843159 - Thanks for pointing me toward the direction of Apache Configuration.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!