【问题标题】:Apache crashes running the controller's index pageApache 在运行控制器的索引页面时崩溃
【发布时间】:2013-09-09 15:28:22
【问题描述】:

我是第一次尝试 CakePHP,所以我尝试运行 CakePHP 网站 (Here) 上的博客教程。我的 CakePHP 安装正确,因为在运行索引页面时,我得到的所有内容都是绿色的。但是当我添加我的第一个控制器、模型和视图并运行我的控制器的索引功能时,Apache 崩溃了,我无法继续。

我已经在 MySql 上创建了名为“blog”的数据库。

这是我的模型类:(位于 app/Model/Post.php)

<?php
class Post extends AppModel {
}

这是我的控制器:(位于 app/Controller/PostsController.php)

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

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

这是我的观点:(位于 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>

这是我要运行的网址:

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

并且 http://[lclhost]/blog/ 给出了 CakePhp 主页面的正确输出。

这是我得到的 Apache 错误日志:

[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.

操作系统:Windows 7

Apache/2.2.11 (Win32)

PHP 版本 5.2.8

有谁知道我做错了什么?

【问题讨论】:

  • Apache 崩溃,我无法继续”你到底看到了什么?查看 Apache 的错误日志以了解更多信息。如果 Apache 崩溃,您可能在 PHP 中发现了一个错误。您使用的是什么操作系统以及什么版本的 Apache?
  • @FritsvanCampen 抱歉。使用错误日志进行更新。
  • @FritsvanCampen 我正在使用 Win7、Apache/2.2.11 (Win32)

标签: php mysql apache cakephp


【解决方案1】:

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

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

我本人亲自遇到了一个段错误,我没有找到解决方案(尝试了所有方法)。我认为这与正则表达式有关。任何状况之下。 Apache/Windows 上的 PHP 有点不稳定。如果你不明白,可以考虑切换到 Linux,它运行起来更稳定。

【讨论】:

  • 除了“复制一些 dll 文件”或“切换到 Linux”之外,我们能否找到更具体的解决方案?
  • 我无权访问您的机器,所以没有。 3221225477 是段错误的通用代码。
猜你喜欢
  • 1970-01-01
  • 2018-07-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多