DebugKit.ToolbarComponent could not be found - cakephp

I followed the instruction in the README.md file in the directory DebugKit. But when I add this line I am getting this error above but when i comment out the line in the AppController then everything is ok and i'm getting "DebugKit plugin is present"
<?php
App::uses('Controller', 'Controller');
class AppController extends Controller {
public $components = array('DebugKit.Toolbar');
}
does anyone know how can i smooth this error out?
I have ubuntu 14.10 CakePHP 2.5

Make sure you have
\DebugKit
\Controller
\Component
\ToolbarComponent.php
In case you don't have this directory (which was the case for me)
then
cd Plugin/DebugKit
sudo mkdir Controller
sudo mkdir Component
sudo gedit ToolbarComponent.php
And then the text editor will pop up and just put the code below
<?php
class ToolbarComponent extends Component {
}

Related

Laravel 5. Error "VirtualAlloc() failed: [0x00000008]" when run "composer dump-autoload"

I get an error "Class does not exist" when trying to populate my DB by executing
"php artisan seed:db".
UserMoviesSeeder.php in the folder database/seeds has the following content:
<?php
use Illuminate\Database\Seeder;
use App\Project;
use App\UserMovie;
use App\User;
class UserMoviesSeeder extends Seeder
{
public function run()
{
$this->call(ProjectsTableSeeder::class);
}
}
class ProjectsTableSeeder extends Seeder {
public function run()
{
DB::table('user_movies')->delete();
DB::disableQueryLog();
UserMovie::create([
'user_id' => 1734805,
'tmdb_id' => 100,
'ratio' => 4
]);
UserMovie::create([
'user_id' => 716091,
'tmdb_id' => 100,
'ratio' => 4
]);
// ... and so on
}
}
I run the command:
php artisan db:seed --class=UserMoviesSeeder
And I get an error:
In Container.php line 752:
Class UserMoviesSeeder does not exist
I tried the following:
composer dump-autoload
It returns:
VirtualAlloc() failed: [0x00000008] ������������ ������ ��� ��������� �������.
VirtualAlloc() failed: [0x00000008] ������������ ������ ��� ��������� �������.
If I rename both, the file and the class to standard name "DatabaseSeeder" and run the command:
php artisan db:seed
Then I have an error:
Out of memory (allocated 547356672) (tried to allocate 1073741824 bytes)
I assume that 547356672 is the size of my seeder file (it is about 5.5Gb).
But why it tries to allocate twice more 1073741824 ?
I have only 8Gb of RAM, so it can't allocate 10Gb.
Previously I had 10Gb seeder in this folder, but now I have just one seeder file of 5.5Gb there.

CakePhp3.3 Error: Class 'CakeHaml\View\CakeHamlView' not found

Pardon me as this is my first questions.
I tried to install a plugin for haml in cakephp 3 manually, and found this k-motoyan/cake-haml
I can't install it using composer because I use cakephp 3.3.*
k-motoyan/cake-haml dev-master requires cakephp/cakephp 3.0.*-dev ->
no matching package found.
So, I tried to install it manually, downloading the zip and put it in [app]/plugins/kmotoyan/cakephp
I follow the readme setup
Setup
Add plugin load line to config/bootstrap.php file:
diff
+ Plugin::load('CakeHaml', ['bootstrap' => true]);
Set the default ViewClass on the src/Controller/AppController.php
file:
```diff class AppController extends Controller {
public $viewClass = 'CakeHaml\View\CakeHamlView'; ```
You can use haml on all your view files with .haml extension.
and put this code below in my config/bootstrap.php
Plugin::load('kmotoyan/CakeHaml', ['bootstrap' => true]);
and this code below in my src/Controller/AppController.php
public $viewClass = 'CakeHaml\\View\\CakeHamlView';
when I load the server, i get this error
Error: Class 'CakeHaml\View\CakeHamlView' not found File
C:\xampp\htdocs\qolega\vendor\cakephp\cakephp\src\View\ViewBuilder.php
Line: 363
when I see line 363 there's this line
return new $className($request, $response, $events, $data);
what should I do?

how to run cron job in cakephp

I am trying to delete data from database using cron job in cakephp . I have created a TestShell.php file at /app/Console/Command/TestShell.php with the following code:
<?php
class TestShell extends AppShell {
public $uses = array('BillsReceivable');
public function main() {
$this->BillsReceivable->deleteAll(array(
'BillsReceivable.days >='=>30,
));
$this->out('Records deleted..');
}
}
My cron command is:
/home/bigzip/public_html/TimeZip/app/Console/cake -app /home/bigzip/public_html/TimeZip/app TestShell
but its not working.please help.
cd /home/bigzip/public_html/TimeZip/app/
sudo Console/cake test
cakephp cron job
cd /full/path/to/app && Console/cake myshell myparam
-working defines the working directory
/home/bigzip/public_html/TimeZip/app/Console/cake.php -app /home/bigzip/public_html/TimeZip/app -working /home/bigzip/public_html/TimeZip/app TestShell
The above code should help you out

CakePHP HTML Helper not working with Images

I have been developing a website in CakePHP 2.5.6 and have suddenly had an issue where when using $this->Html->Image(''); the image wont display on the page and I get this error if I go to the Image URL Directly:
Missing Controller
Error: ImgController could not be found.
Error: Create the class ImgController below in file: app/Controller/ImgController.php
<?php
class ImgController extends AppController {
}
Notice: If you want to customize this error message, create app/View/Errors/missing_controller.ctp
As I haven't been using CakePHP for long im not sure where to start with resolving this, its never done this before to me.
Any help would be appreciated,
Steve
EDIT:
The example I have been using is this:
<?php echo $this->Html->image('cake.power.gif');?>
it returns the following:
<img src="/trunk/img/cake.power.gif" alt="" />
I have checked and the image does exist on my server in the directory app/webroot/img/cake.power.gif

CakePHP 2.1 new install Missing Controller Error

I am completely new to CakePHP and installed 2.1. I am getting this error:
Missing Controller
Error: Index.phpController could not be found.
Error: Create the class Index.phpController below in file: app\Controller\Index.phpController.php
<?php
class Index.phpController extends AppController {
}
Notice: If you want to customize this error message, create app\View\Errors\missing_controller.ctp
Stack Trace
APP\webroot\index.php line 96 → Dispatcher->dispatch(CakeRequest, CakeResponse)
ROOT\index.php line 40 → require(string)
I followed their guide at http://book.cakephp.org/2.0/en/installation/advanced-installation.html and tried everything it stated:
I enabled mod_rewrites (they were already enabled from something else)
I have all the .htaccess files in the directories
I have cake installed under my document root so I access it at localhost/cakephp/index.php
I do not know where to proceed from here. Thanks for any help you can give me.
Update: I just re-read your question and realized you're loading http://localhost/cakephp/index.php. Don't do that. Since you appended "index.php", it is trying to load a controller called "index.php" and the action "index" for that controller. Resulting mapped path to the "index.php controller" is app\Controller\Index.phpController.php.
Since you have the rewrites enabled, browse to http://localhost/cakephp without appending any filename.
Original answer:
Assuming you're using Apache, double-check the .htaccess in your /app/webroot directory. It should include the following:
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Based on your error, it doesn't look like it's properly appending the path after your index.php file.
If you are using cakephp 2.0 or greater than rename the controller file name as the class name.
ie TaskController.php
class TasksController extends AppController {
--Your code inside class
}
I hope this will help you
the easiest solution is to stick to the "live environment" as close as possible.
this means using vhosts to use a "domain" and correctly root down to your webroot dir:
http://www.dereuromark.de/2011/05/29/working-with-domains-locally/
this leaves almost no room for error and also helps with other potential problems like "absolutely linked asset files" etc

Resources