dongmie3526 2014-12-06 17:26
浏览 60
已采纳

MAMP上的CakePHP:CakePHP安装和WordPress都安装在子文件夹中

On my local MAMP install, I have a WordPress site, and am trying to get a CakePHP site ( 2.5.6 ) going using their blog tutorial. I want to try CakePHP out and see if it is suitable for a future project.

Interesting portion of folder structure as follows:

htdocs
|_ cakePHPBox
|  |_ app
|_ local_blog

The WordPress site was originally installed in the root folder. After moving that, I ended up with an .htaccess file in the htdocs root that contained the following:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^cakePHPBox/(.*)$ /cakePHPBox/$1 [L,QSA]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/cakePHPBox [NC]
RewriteBase /local_blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/cakePHPBox [NC]
RewriteRule . /local_blog/index.php [L]
</IfModule>

# END WordPress

The .htaccess file in htdocs/cakePHPBox looks like this:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteBase /cakePHPBox
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

The .htaccess file in htdocs/cakePHPBox/app looks like this:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cakePHPBox
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]

The .htaccess file in htdocs/cakePHPBox/app/webroot looks like this:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /cakePHPBox
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

These are modified from the originals; I am trying to account for the subfolder that CakePHP lives in in all of them, and the one in htdocs is also trying to account for WordPress' subfolder.

The WordPress blog works. The cakePHP tutorial doesn't! CakePHP's "landing page" pulls up without problem.

Trying to access the URL http://localhost/cakePHPBox/posts/index as per the tutorial's instructions gives me this error. I can tell there's trouble because it prints the file across the top of the page instead of executing it, but I don't know why that is happening.

Unhappy CakePHP

Various existing StackOverflow questions and answers have gotten me this far, but now I'm stuck!

展开全部

  • 写回答

1条回答 默认 最新

  • duanmajing9332 2014-12-06 18:39
    关注

    You appear not to have a PostsController.php file in your app/Controller directory. Might that be the case? CakePHP seems to be working up to that point though given the fact that you are getting to app/webroot/index.php.

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

报告相同问题?

悬赏问题

  • ¥15 各位专家求此答案解析
  • ¥15 llama-factory训练日志epoch为什么是浮点数?
  • ¥500 我想做一个股票策略的回测AI工具(网页版)python语言、Pine Script
  • ¥15 生信空转NICHES分析中runNICHES函数报错
  • ¥30 地学数据三维可视化基于克里金插值的三维可视化
  • ¥15 stc8g1k08a-sop8控制led代码问题。
  • ¥50 让画布在弹出的新的浏览器页面上运行绘画
  • ¥15 VB6.0获取路径及文件信息问题
  • ¥15 mbed库rsa算法段错误
  • ¥15 SG-cyclic模式Axi-Dma,如何实时更新缓存区内数据