1

I'm trying CakePHP for the first time so I'm trying to run the blog tutorial located on CakePHP's website (Here). My CakePHP is installed correctly because when run the index page I get everything in green. But when I added my first controller, model and view and ran the index function of my controller, Apache crashes and I cannot continue.

I have already created the database called "blog" on my MySql.

This is my model class: (located in app/Model/Post.php)

<?php
class Post extends AppModel {
}

This is my controller: (located at app/Controller/PostsController.php)

class PostsController extends AppController {
    public $helpers = array('Html', 'Form');

    public function index() {
        $this->set('posts', $this->Post->find('all'));
    }
}

And this is my view: (located at app/View/Posts/index.ctp)

<!-- File: /app/View/Posts/index.ctp -->

<h1>Blog posts</h1>
<table>
    <tr>
        <th>Id</th>
        <th>Title</th>
        <th>Created</th>
    </tr>

    <!-- Here is where we loop through our $posts array, printing out post info -->

    <?php foreach ($posts as $post): ?>
    <tr>
        <td><?php echo $post['Post']['id']; ?></td>
        <td>
            <?php echo $this->Html->link($post['Post']['title'],
array('controller' => 'posts', 'action' => 'view', $post['Post']['id'])); ?>
        </td>
        <td><?php echo $post['Post']['created']; ?></td>
    </tr>
    <?php endforeach; ?>
    <?php unset($post); ?>
</table>

This is the url I'm trying to run:

http://[lclhost]/blog/posts/

And http://[lclhost]/blog/ gives the correct output of the main CakePhp page.

This is the Apache error log I get:

[Mon Sep 09 17:32:28 2013] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Mon Sep 09 17:32:34 2013] [warn] pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Sep 09 17:32:34 2013] [notice] Digest: generating secret for digest authentication ...
[Mon Sep 09 17:32:34 2013] [notice] Digest: done
[Mon Sep 09 17:32:35 2013] [notice] Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8 configured -- resuming normal operations
[Mon Sep 09 17:32:35 2013] [notice] Server built: Dec 10 2008 00:10:06
[Mon Sep 09 17:32:35 2013] [notice] Parent: Created child process 10516
[Mon Sep 09 17:32:35 2013] [notice] Digest: generating secret for digest authentication ...
[Mon Sep 09 17:32:35 2013] [notice] Digest: done
[Mon Sep 09 17:32:36 2013] [notice] Child 10516: Child process is running
[Mon Sep 09 17:32:36 2013] [notice] Child 10516: Acquired the start mutex.
[Mon Sep 09 17:32:36 2013] [notice] Child 10516: Starting 250 worker threads.
[Mon Sep 09 17:32:36 2013] [notice] Child 10516: Starting thread to listen on port 443.
[Mon Sep 09 17:32:36 2013] [notice] Child 10516: Starting thread to listen on port 81.

OS: Windows 7

Apache/2.2.11 (Win32)

PHP Version 5.2.8

Does anyone know what I'm doing wrong?

4

1 回答 1

1

搜索Parent: child process exited with status 3221225477并尝试您找到的解决方案。

一个常见的似乎是复制一些.dll文件。

我个人遇到了一个段错误,我还没有找到解决方案(尝试了一切)。我认为这与正则表达式有关。任何状况之下。Apache/Windows 上的 PHP 有点不稳定。如果您无法弄清楚,请考虑切换到 Linux,它运行起来更加稳定。

于 2013-09-09T15:36:39.367 回答