Some weeks ago I inherited a CakePHP application that I'm supposed to deploy to a server. I went through the CakePHP tutorial and put my hands to work. The problem is that I can't pass from the front page (app/Pages/home.ctp), any links from there get to a page with the error in subject. Trying direct access to routes like /view/action have the same result.
I made a simple test that yielded a strange result: there's a model called User with its respective controller and view. I copied the view folder to another CakePHP app, and when I access to:
I get an error saying the User model doesn't exist, which is correct since I only copied the view folder. But when I try a similar thing in the legacy application:
Reading the messages in this list I tried the following: . changed the debug level to 1 - no further messages are shown . deleted the contents of /app/tmp/cache/models/ and /app/tmp/cache/persistent/ . verified .htaccess files are present . verified www-data has permissions to write on .htaccess files
But none of these actions had effect. If anyone as a clue on what else may be causing this I'd appreciate to know.
> I get an error saying the User model doesn't exist, which is correct since
> I only copied the view folder. But when I try a similar thing in the legacy
> application:
> http://localhost/legacyApp/User
> I get the address not found error.
Have you checked that the paths inside your .htaccess files are correct?
If you've renamed folders, e.g. "legacyApp" or whatever, then the rewrites
might be borked.
-- Daniel Baird
I've tried going to the XHTML <bar /> a few times, but it's always closed.
On Wednesday, 25 July 2012 00:57:22 UTC+2, Daniel Baird wrote
> Have you checked that the paths inside your .htaccess files are correct? > If you've renamed folders, e.g. "legacyApp" or whatever, then the rewrites > might be borked.
Hi Daniel, thank you for the reply.
The .htaccess files are exactly equal to those found in the cakephp tutorial. Should this be the case? Here are the contents of the file in the root folder:
I believe the answer to these three questions is yes. I followed the Advanced configuration in the tutorial, but for clarification I reproduce below the contents of my Apache files.
DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory>
# CakePHP <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www> Options Indexes FollowSymLinks MultiViews AllowOverride All Order Allow,Deny Allow from all </Directory>
On Wednesday, 25 July 2012 17:55:38 UTC+2, scs wrote:
> Try a link like http://localhost/myApp/users/ > The url should be pointint the controller version of the name (lower case > and pearl) so if you want to go to your add function in your > UsersController it would be http://localhost/myApp/users/add
There's a detail in the first message that may provide further clues on what is wrong with this project. No matter what debug level I try (0, 1 or 2) I don't get any messages. It is as if the core.php file was being ignored.
Ok I'm not sure what the difference in the links you posted are as both look like the same address.
As for the " Error: UsersController could not be found. " this error is correct if you don't have the UsersController.php with an add function. Make sure you have the controller created. Example:
<?php
App::uses('CakeEmail', 'Network/Email');
class UsersController extends AppController {
var $name = 'Users';
var $uses = array('User', 'Ticket');
public function index() {
}
public function edit() {
}
On Thursday, July 26, 2012 5:51:52 AM UTC-4, Luís de Sousa wrote:
> Hello again,
> There's a detail in the first message that may provide further clues on > what is wrong with this project. No matter what debug level I try (0, 1 or > 2) I don't get any messages. It is as if the core.php file was being > ignored.
On Thursday, 26 July 2012 17:57:42 UTC+2, scs wrote:
> Ok I'm not sure what the difference in the links you posted are as both > look like the same address.
They are different addresses, one for the legacy app and the other for a new app I created.
> As for the " Error: UsersController could not be found. " this error is > correct if you don't have the UsersController.php with an add function. > Make sure you have the controller created.
This error is what I expected. I'm just trying to test the addresses in another application, and there it works.
you can copy all message error or capture error interfae and resent this
mail again I hope i can help you
เมื่อ 13 ส.ค. 2012 19:23, "Luís de Sousa" <luis.a.de.so...@gmail.com>
เขียนว่า:
> Please.
> --
> You received this message because you are subscribed to the Google Groups
"CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
Ok After re reading the top it sound like you said you copy only the View/User folder to the legacy and that is giving you problems. If this is the case, you need to also move the Controller and Model files for users to the legacy app. If both of these files are already there show us what you have in your user controller/model files.
On Tuesday, July 24, 2012 10:36:47 AM UTC-4, Luís de Sousa wrote:
> Dear all,
> Some weeks ago I inherited a CakePHP application that I'm supposed to > deploy to a server. I went through the CakePHP tutorial and put my hands to > work. The problem is that I can't pass from the front page > (app/Pages/home.ctp), any links from there get to a page with the error in > subject. Trying direct access to routes like /view/action have the same > result.
> I made a simple test that yielded a strange result: there's a model called > User with its respective controller and view. I copied the view folder to > another CakePHP app, and when I access to:
> I get an error saying the User model doesn't exist, which is correct since > I only copied the view folder. But when I try a similar thing in the legacy > application:
> Reading the messages in this list I tried the following:
> . changed the debug level to 1 - no further messages are shown
> . deleted the contents of /app/tmp/cache/models/ and > /app/tmp/cache/persistent/
> . verified .htaccess files are present
> . verified www-data has permissions to write on .htaccess files
> But none of these actions had effect. If anyone as a clue on what else may > be causing this I'd appreciate to know.
The error I'm reporting happens with the legacy app, as I got it, without any changes applied.
Here are the contents of Model/user.php:
<?php
class user extends AppModel { public $name = "connection";
public $validate = array( 'NOM' => 'not_empty' ); }
And the contents of Controller/usersController.php:
<?php
class usersController extends AppController { public $name = "users"; public $helpers = array('Html', 'Form');
public function index() { $this->set('usersArray', $this->user->find('all')); }
public function details($id = null) { $this->user->id = $id; $this->set('userRead', $this->user->read()); }
public function add() { if ($this->request->is('post')) { if ($this->user->save($this->request->data))
{ $this->Session->setFlash("Your account has been saved"); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash("Error"); } } } }
On Tuesday, 14 August 2012 20:47:22 UTC+2, scs wrote:
> Ok After re reading the top it sound like you said you copy only the > View/User folder to the legacy and that is giving you problems. If this is > the case, you need to also move the Controller and Model files for users to > the legacy app. If both of these files are already there show us what you > have in your user controller/model files.
> And the contents of Controller/usersController.php:
> <?php
> class usersController extends AppController > { > public $name = "users"; > public $helpers = array('Html', 'Form');
> public function index() > { > $this->set('usersArray', $this->user->find('all')); > }
> public function details($id = null) > { > $this->user->id = $id; > $this->set('userRead', $this->user->read()); > }
> public function add() > { > if ($this->request->is('post')) > { > if ($this->user->save($this->request->data))
> { > $this->Session->setFlash("Your account has been > saved"); > $this->redirect(array('action' => 'index')); > } else > { > $this->Session->setFlash("Error"); > } > } > } > }
> Thank you for reading,
> Luís
> On Tuesday, 14 August 2012 20:47:22 UTC+2, scs wrote:
>> Ok After re reading the top it sound like you said you copy only the >> View/User folder to the legacy and that is giving you problems. If this is >> the case, you need to also move the Controller and Model files for users to >> the legacy app. If both of these files are already there show us what you >> have in your user controller/model files.