I’m a beginner CakePHP developer. I’m encountering an Error: The requested address ‘/unsigned_images/index’ was not found on this server.
I’m using the following codes:
Model: app/models/unsigned_image.php
<?php
class UnsignedImage extends AppModel{
var $name = 'UnsignedImage';
var $useDbConfig = 'tabletApp';
var $useTable = 'unsigned_images';
//var $useTable = false;
}
?>
Controller: app/controllers/unsigned_images_controller.php
<?php
class UnsignedImagesController extends AppController{
var $name = 'UnsignedImages';
var $pageTitle = 'Hello world!';
var $helpers = array('Javascript');
var $components = array('Auth', 'Slogic');
function index(){
$this->layout = 'default';
$this->set('data','Hello World!');
$this->set('unsigned_images', $this->UnsignedImage->find('all') );
}
}
?>
View: app/views/unsigned_images/index.ctp
<div style='font-weight: bold; margin: 0 0 10px 0;'>View All Signatures</div>
<table>
<tr>
<th>ID</th>
<th>Session ID</th>
</tr>
<?php
foreach( $unsigned_images as $unsigned_image ){
echo "<tr>";
echo "<td>{$unsigned_image['UnsignedImage']['id']}</td>";
echo "<td>{$unsigned_image['UnsignedImage']['session_id']}</td>";
echo "</tr>";
}
?>
</table>
- I have unsigned_images table in my database
- When I access http://somedomain.com/unsigned_images/index/, it prints the error.
- When I just use var $useTable = false; in the model, no errors were printed.
Many thanks for any help! 🙂
Two blog posts (here and here) suggest the following steps:
/tmpdirectory is writable/tmpsubfoldersSince the errors disappear when you set
$useTabletofalse, I would pay particular attention to the first step. Make sure you have the correspondingtabletAppdatabase configuration in your/app/config/database.phpfile.Also, more helpful troubleshooting information may be available by setting the following line in your
core.phpconfiguration file: