cakephp - error when trying to use Cake Console - cakephp

i'm trying to use Twitter Bootstrap in my Cakephp. Thus i follow the tutorial given here>>https://github.com/slywalker/TwitterBootstrap.
When i try to run the command
Console/cake TwitterBootstrap.copy
this is what turns out:
kostas#ubuntu-laptop:~/Desktop/Projects/mailer/app$ Console/cake TwitterBootstrap.copy
Error: Shell class CopyShell could not be found.
#0 /home/kostas/Desktop/Projects/mailer/lib/Cake/Console/ShellDispatcher.php(190): ShellDispatcher->_getShell('TwitterBootstra...')
#1 /home/kostas/Desktop/Projects/mailer/lib/Cake/Console/ShellDispatcher.php(68): ShellDispatcher->dispatch()
#2 /home/kostas/Desktop/Projects/mailer/app/Console/cake.php(37): ShellDispatcher::run(Array)
#3 {main}
kostas#ubuntu-laptop:~/Desktop/Projects/mailer/app$
Do you know what's happening? :/ I have been trying to bypass this problem for a while without having found any solution yet.
Thank you in advance

Related

Cakephp - MissingControllerException Controller class Robots.txt

My error log is loaded with all of the missing errors, for robots.txt, .css files, .png files and more. The site works, but getting errors. How do I get rid of these errors? I feel like I'm missing something simple, maybe a route or something?
2016-05-07 16:11:20 Error: [MissingControllerException] Controller class Robots.txtController could not be found.
#0 /app/webroot/index.php(93): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}
2016-05-07 16:32:50 Error: [MissingControllerException] Controller class CssController could not be found.
#0 /app/webroot/index.php(93): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}
If you try to fetch a resource that doesnt not exist, cake will try to find a controller by that name. So if you try to access /css/whatever and you have no css folder, cake will try to find a CssController to take you to /:controller/:action

CakePHP empty error in error log

We have a website that everytime you go to the home page, gets an empty error logged in the error log.
2015-01-26 14:52:27 Error: [NotFoundException] Not Found
Request URL: /
Stack Trace:
#0 /var/www/vhosts/.nl/subdomains//httpdocs/lib/Cake/View/View.php(948): include()
#1 /var/www/vhosts/.nl/subdomains//httpdocs/lib/Cake/View/View.php(910): View->_evaluate('/var/www/vhosts...', Array)
#2 /var/www/vhosts/.nl/subdomains//httpdocs/lib/Cake/View/View.php(471): View->_render('/var/www/vhosts...')
#3 /var/www/vhosts/.nl/subdomains//httpdocs/lib/Cake/Controller/Controller.php(954): View->render('home', NULL)
#4 /var/www/vhosts/.nl/subdomains//httpdocs/app/Controller/PagesController.php(41): Controller->render('home')
#5 [internal function]: PagesController->display('home')
#6 /var/www/vhosts/.nl/subdomains//httpdocs/lib/Cake/Controller/Controller.php(490): ReflectionMethod->invokeArgs(Object(PagesController), Array)
#7 /var/www/vhosts/.nl/subdomains//httpdocs/lib/Cake/Routing/Dispatcher.php(191): Controller->invokeAction(Object(CakeRequest))
#8 /var/www/vhosts/.nl/subdomains//httpdocs/lib/Cake/Routing/Dispatcher.php(165): Dispatcher->_invoke(Object(PagesController), Object(CakeRequest))
#9 /var/www/vhosts/.nl/subdomains//httpdocs/app/webroot/index.php(108): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#10 {main}
I have no idea what causes this error. I tried deleting the whole file so you only see a blank page, but then the error still logs. Can someone point me in the right direction?
EDIT to answer some questions:
We have two layouts. One normal default.ctp and a home.ctp, the home page only has the layout/home.ctp, no pages/home.ctp.
It turns out my project missed the "Views/Pages/home.ctp" file. The website has two Layouts, home.ctp and default.ctp (for the rest of the pages). Because we didn't have anything in "Views/Pages/home.ctp" we deleted the file, but because of that we got the error. When we put back the file (with nothing in it) the error went away.
If you want to read more of the problem, look at the links ndm provided, the solved my question!

Strange CakePHP message: View file is missing

I am developing a website in CakePHP.
When I go one page back / forward (arrow in your browser) I get the following:
{
"code": 500,
"url": "\urlToWebisite/uploads\/view\/31",
"name": "View file "urlToWebisite\\app\\View\\Uploads\\json\\view.ctp" is missing."
}
The whole page is white and this is the only thing I see...
My error log says:
2014-04-12 22:10:27 Error: [MissingViewException] View file "C:\url\app\View\Users\json\view.ctp" is missing.
Exception Attributes: array (
'file' => 'C:\\url\\app\\View\\Users\\json\\view.ctp',
)
Request URL: /url/users/view/1
Stack Trace:
#0 C:\url\lib\Cake\View\JsonView.php(107): View->_getViewFileName(NULL)
#1 C:\url\lib\Cake\Controller\Controller.php(952): JsonView->render(NULL, NULL)
#2 C:\url\lib\Cake\Routing\Dispatcher.php(192): Controller->render()
#3 C:\url\lib\Cake\Routing\Dispatcher.php(160): Dispatcher->_invoke(Object(UsersController), Object(CakeRequest), Object(CakeResponse))
#4 C:\url\app\webroot\index.php(108): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#5 {main}
Posting my appController won't be necessary: It's only loading models and settings variables for view.
When I reload the page, it loads perfect.
I don't know where to search to the solution. So, please give me some hints!
If I didn't place enough information, please comment ;)
Greetzz
Found the solution... I disabled all .js files and the problem was gone... Now going to find the wrong .js file.
This code:
$( '#bottom-panel .twitter-feed' ).each(function(){
$(this).uouTwitterFeed();
});
Costed me 2 hours :)

CakePHP 2 MissingControllerException in error.log => show accessed url

Is it possible to create/extend a CakePHP Exception handler which shows the url the user tried to access which throws the exception?
Usually when I look into my error.log file I see something like this:
2012-08-01 13:39:20 Error: [MissingControllerException] Controller class UserController could not be found.
#0 /www/htdocs/w0081e0e/app/webroot/index.php(104): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 {main}
I have a working UsersController but I'm not sure which url the user tried to access which in return throw this error. It would help me to see the url in the error.log file. Is that possible? Would I have to create/extend an exception handling file?
Update:
Instead of writing my own ExceptionHandler I just updated the "handleException" function in "lib/Cake/Error/ErrorHandler.php":
if (!empty($config['log'])) {
$message = sprintf("[%s] %s\n%s",
get_class($exception),
$exception->getMessage(),
$exception->getTraceAsString().' - http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n"
);
CakeLog::write(LOG_ERR, $message);
}
I know that this is overwritten once I update my CakePHP Version but its a quick fix that works really fine for my situation.
You can write your own exception handlers. It's pretty well documented at http://book.cakephp.org/2.0/en/development/exceptions.html#create-your-own-exception-handler-with-exception-handler
Anyway the URL seems to be like http://something/user/something. The error says UserController could not be found, which is true as you only have a UsersController (plural). If you just want to avoid this error it might be enough to find the file which creates a /user/ URL.

SolrPhpClient not working

I have a question. SolrphpClient is not working with multicore.
I have two cores in my solr say core1 and core2.
While creating object of SolrPhpClient I am using the following syntax.
$solr = new Apache_Solr_Service('192.168.12.226', '8983', 'solr/core1/' );
It's giving a fatal error...
Fatal error: Uncaught exception 'Exception' with message '"500" Status: null_javalangNullPointerException_at_javaioStringReaderinitStringReaderjava50__at_orgapachelucenequeryParserQue' in C:\xampp\htdocs\solrsite\SolrPhpClient\Apache\Solr\Service.php:334 Stack trace: #0 C:\xampp\htdocs\solrsite\SolrPhpClient\Apache\Solr\Service.php(964): Apache_Solr_Service->_sendRawGet('http://192.168....') #1 C:\xampp\htdocs\solrsite\script\productlist.php(403): Apache_Solr_Service->search(NULL, 0, 15, Array) #2 C:\xampp\htdocs\solrsite\index.php(510): include_once('C:\xampp\htdocs...') #3 {main} thrown in C:\xampp\htdocs\solrsite\SolrPhpClient\Apache\Solr\Service.php on line 334
Solr is working fine in admin part.
Any help will be appreciated.
Based on your url that you provided:
http://192.168.12.226:8983/solr/core1/select?fl=ST_StockCode%2CST_ItemCategory%2CST_Stone1%2CST_Stone2%2CST_LowPrice%2CST_WebPrice
%2CST_Name%2CST_ArticleType%2CST_MetalType%2CST_HighPrice%2CST_ImageFileName%2Cis_clearance%2CGroupName
%2CFreePnp%2CST_ItemSize%2CST_MarketPrice&sort=ST_Name+desc&version=1.2&wt=json&json.nl=map&start=0&rows=1
It does not look like you are providing an actual query q= value in your request. I would guess that is the reason for the error... I would suggest that you start with setting the SolrPhpClient so that is passes q=*:* to start with.

Resources