dongmie3526 2014-12-07 01: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-07 02: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 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀