Cakephp via Shell returns error: class Helloshell could not be Loaded

Asked

Viewed 156 times

2

I configured and installed everything with respect to Cakephp to use via command line in Ubuntu. I created and saved the following:

class HelloShell extends AppShell {
public function main() {
    $this->out('Hello world.');
}
}

Which is their sample code. But when running via command line this error is returned, which cannot load the class.

It gets in:

/home/ubuntu/cakephp/apps/almofadagram/Console/Command/HelloShell.php

And executed from right there, but as said is returned the error:

Error: Class HelloShell could not be loaded.
  • 2

    Which command line are you running?

  • The error message is "could not be found" or "could not be Loaded"? (The title says one thing and the question says another!)

  • I actually typed wrong in the title. It’s "could not be Loaded"

1 answer

2


According to the manual on http://book.cakephp.org/2.0/en/console-and-shells.html

From your application directory, run:

Console/cake hello

That is to say, from the directory of your application.

So, first go to the application directory, and then try again:

cd /home/ubuntu/cakephp/apps/almofadagram
./Console/cake hello
  • The Ubuntu returns to me: -bash: ./Console/cake: Permission denied

  • By the way, I don’t understand. If I go in the directory and rotate cake it runs(Not the script, but the cake command).

  • Well, I gave permission 755 to cake that had not done. Now runs. But now gave another problem, I will try to solve.

  • Well, now I’m having permission problems. When I spin it with sudo hello Word works, i.e., the script runs. But when using sudo, it error. What kind of permission should I give?

  • See http://stackoverflow.com/a/88796/370290 and http://stackoverflow.com/a/17686488/370290

  • At the root of the cake (cd /home/ubuntu/cakephp) execute sudo chown -R ubuntu:www-data . (based on the suggestion on http://stackoverflow.com/a/88796/370290)

  • The ideal is to make a new question informing the exact error that is appearing now - it is about another problem. (I also recommend accepting this answer, so I get a few points and get motivated to help more!) ;-)

  • I discovered the problem, as I tested with root, Cakephp created two files, inside /tmp/cache/persistent, then how these two files belonged to the root user, when I ran it within another script with exec He returned me error of permission. I deleted these two files, and ran the script again, where it created again these two files belonging to www-data

  • It’s all right. Thank you.

Show 4 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.