barbushin / php-console

Handle PHP errors, dump variables, execute PHP code remotely in Google Chrome
https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef
MIT License
1.34k stars 283 forks source link

Cakephp integration #80

Closed serchmail closed 9 years ago

serchmail commented 9 years ago

Has anybody install php-console with cakephp?

I have copy php-console in Vendor directory and add the include: App::import('Vendor', 'php-console-master', array('file' => 'php-console-master\src\PhpConsole__autoload.php'));

I have try copy folder in webroot (with different include).

Some functions are right but I can't execute php code with "console eval".

Any suggestions?

Thanks in advance.

barbushin commented 9 years ago

Can you attach source code how you enabled console eval?

serchmail commented 9 years ago

Of course. As aditional information, when I push Ctrl-Enter, console sais: "content.js:4 Console was cleared".

I have put this code in App/Config/bootstrap.php:

// require_once('../webroot/php-console-master/src/PhpConsole/autoload.php'); //Another try. App::import('Vendor', 'php-console-master', array('file' => 'php-console-master\src\PhpConsoleautoload.php'));

$password = "PaSs"; //Change to real pass if(!$password) { die('Please set $password variable value in ' . FILE); }

$connector = PhpConsole\Connector::getInstance(); $connector->setPassword($password); // Eval requests listener can be started only in password protected mode

$evalProvider = $connector->getEvalDispatcher()->getEvalProvider(); $evalProvider->disableFileAccessByOpenBaseDir(); // means disable functions like include(), require(), file_get_contents() & etc $evalProvider->addSharedVar('uri', $_SERVER['REQUEST_URI']); // so you can access $_SERVER['REQUEST_URI'] just as $uri in terminal $evalProvider->addSharedVarReference('post', $_POST); $connector->startEvalRequestsListener(); // must be called after all configurations

barbushin commented 9 years ago

Try to remove this line $evalProvider->disableFileAccessByOpenBaseDir();. And I recommend to use require_once('../webroot/php-console-master/src/PhpConsole/__autoload.php'); for autoload to be called before any framework calls.

serchmail commented 9 years ago

I have make the suggested changes and it's working fine. Thanks for your fast and precise information.