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 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog