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?