Quantcast

Error: The requested address was not found on this server.

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Error: The requested address was not found on this server.

Luís de Sousa
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:

http://localhost/myApp/User

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.

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.

Thank you and regards.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Daniel Baird
On Wed, Jul 25, 2012 at 12:36 AM, Luís de Sousa <[hidden email]> wrote:
Dear all,
[...]
when I access to:
http://localhost/myApp/User

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.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa

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:

 <IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

Thank you,

Luís

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Andy Gale
On Wed, Jul 25, 2012 at 10:49 AM, Luís de Sousa
<[hidden email]> wrote:
>
>  <IfModule mod_rewrite.c>
>    RewriteEngine on
>    RewriteRule    ^$ app/webroot/    [L]
>    RewriteRule    (.*) app/webroot/$1 [L]
> </IfModule>

Things to check -

1. Is your web server running Apache?
2. Does your apache server allow .htaccess

    http://httpd.apache.org/docs/current/mod/core.html#allowoverride

3. Does your apache server have mod_rewrite enabled?

    http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Cheers,

Andy

--
Andy Gale
http://andy-gale.com
http://twitter.com/andygale

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
On Wednesday, 25 July 2012 12:55:08 UTC+2, Andy Gale wrote:
1. Is your web server running Apache?
2. Does your apache server allow .htaccess

    http://httpd.apache.org/docs/current/mod/core.html#allowoverride

3. Does your apache server have mod_rewrite enabled?

    http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Cheers,

Thank you Andy for the reply.

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.

Any other clues please reply. Thank you.

=====  /etc/apache2/sites-available/default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        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>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

== /etc/apache2/apache2.conf

# CakePHP
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory /var/www>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order Allow,Deny
    Allow from all
</Directory>

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

 

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
In reply to this post by Luís de Sousa
On 25 July 2012 14:50, Andy Gale wrote:

>
>> <VirtualHost *:80>
>>         ServerAdmin webmaster@localhost
>>
>>         DocumentRoot /var/www
>>
>
> I'm a bit rusty on CakePHP and Apache setup but should the document
> root not be something like:
>
> DocumentRoot "/var/www/app/webroot"
>
> ???

Hi Andy, I don't think so. That is the Apache document root, I believe.

Thank you for answering nonetheless.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
scs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

scs
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  

On Wednesday, July 25, 2012 9:46:26 AM UTC-4, Luís de Sousa wrote:
On 25 July 2012 14:50, Andy Gale wrote:

>
>> <VirtualHost *:80>
>>         ServerAdmin webmaster@localhost
>>
>>         DocumentRoot /var/www
>>
>
> I'm a bit rusty on CakePHP and Apache setup but should the document
> root not be something like:
>
> DocumentRoot "/var/www/app/webroot"
>
> ???

Hi Andy, I don't think so. That is the Apache document root, I believe.

Thank you for answering nonetheless.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
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  

Hi scs, thank you for you reply.

This address:  http://localhost/legacyApp/users/add

Returns: "Error: The requested http://localhost/legacyApp/users/add address was not found on this server."

Whereas this address: http://localhost/legacyApp/users/add

Returns: "Error: UsersController could not be found."

In both applications the contents of the app/Views/Users folder is exactly the same.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
In reply to this post by Luís de Sousa
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.

Thank you for reading.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
scs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

scs
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() {
}

public function add() {
}
}
?>


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.

Thank you for reading.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
Hi scs, my answers go below.

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.

Thank you.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
Any further suggestions on this issue are very welcome. Thank you.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
In reply to this post by Luís de Sousa
Good morning everyone,

I once again beg for your help, I have no idea on how to proceed on this.

Thank you.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
Please.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

suttipong Pratum

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" <[hidden email]> เขียนว่า:
>
> Please.
>
> --
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>  
>  

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
scs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

scs
In reply to this post by Luís de Sousa
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:

http://localhost/myApp/User

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.

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.

Thank you and regards.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Luís de Sousa
Hi scs,

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");
                }
            }
        }
    }

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.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Error: The requested address was not found on this server.

Bharat Maheshwari
Hello,
I think your controller needs some modifications might be it will work


first rename the Controller/usersController.php to Controller/UsersController.php:

and then in UsersController.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");
                }
            }
        }
    }
might be it work................



On Monday, August 20, 2012 1:11:49 PM UTC+5:30, Luís de Sousa wrote:
Hi scs,

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");
                }
            }
        }
    }

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.

--
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 
Loading...