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 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?