Typing the command "cake" in console shows no output - cakephp

Typing the command "cake" in console shows no output, no errors or anything like that. It just prints about 4 blank lines.
Has anyone else experience this problem before and how did you fix it?
C:\xampp\htdocs\project\app>cake
C:\xampp\htdocs\project\app>

I have had similar problem a moment ago and I found the solution. the problem was not the path for me. I have turn on the debug from 0 to 2. and it shows some error instead of empty output and I try to fix the error (which was in the core.php) and it works now.
So try to debug it like me and fix the error.
Hope it helps.

cake is not directly available in app - while you are in the right folder you still need to call the cake command relative from there:
\app>.\Console\cake
Note that this syntax is unique to Windows
For UNIX use
\app>Console/cake
In case you are using an old app version or didnt bake your application with the Console folder (which you should, though), you can also call the cake core version of it relatively from the APP dir:
\app>..\lib\Cake\Console\cake
(WIN)
\app>../lib/Cake/Console/cake
(UNIX)
Either way the cake file needs to have sufficient execution rights (UNIX mainly) and PHP must be in the system env path. Then it will all work out of the box.

Run this command in Cake/Console folder. I think you are not running it in the right folder.

In this directory:
C:\xampp\htdocs\project\app>
type this command:
php Console/cake.php
which will output:
Current Paths:
-app: app
-working: C:\xampp\htdocs\project\app
-root: C:\xampp\htdocs\project
-core: C:\xampp\htdocs\project\lib
Changing Paths:
Your working path should be the same as your application path. To change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp
....

Similar issue encountered where Console wasn't outputting anything after installing Cake via Composer instead of git clone - no error, just returning a blank line. To solve it I made a backup of app/ (mv app/ app.bak/) and then used vendor/bin/cake -app app bake to bake a brand new app/ folder. Once that process was complete running Console from app/Console/cake started working again. Then just moved my app.bak/ code back in place. I'm assuming over time the paths present or code in app/Console had become unworkable.
Bringing back in the old code I was able to narrow down the issue to using Apc as a cache engine. Reverting to $engine = 'File'; in core.php and bootstrap.php solved the problem and Console worked as expected.

I guess you are using a composer powered cakephp which has console command in Vendor folder. If so, try this ;
AppRoot/Vendor/bin/cake
or you may try with full path to fw;
PATH_TO_APP\Vendor\cakephp\cakephp\lib\Cake\Console\cake.bat

Related

Gatsby build path issues

Having issues running gatsby build with gatsby-starter-wordpress-advanced theme:
Error: ENOENT: no such file or directory, open 'C:\Users\Tobias\Desktop\Gatsby\gatsby-starter-wordpress-advanced\.template-cache\tmp-\.js'"
I figured this might be a problem with the path. The path should rather look like:
writing tmp-new-page/ template: open '.template-cache/tmp-new-page.js'
See repo: https://github.com/henrikwirth/gatsby-starter-wordpress-advanced/blob/master/create/utils.js
Line 53 you find the function createPageWithTemplate. I've tried console.log(page.uri) to see what's going on. It outputs the filename correctly. I've also tried with gatsby clean to clear the cache. It seems to be some kind of backslash issue where the path comes with a \ .js at the end instead of sample-page.js:
no such file or directory, open 'C:\Users\Tobias\Desktop\Gatsby\gatsby-starter-wordpress-advanced\.template-cache\sample-page\.js'
The issue have been resolved. The problem was related to update in WPGraphQL WordPress plugin. Had to update the paths, because the page.uri is different in the newer versions of WPGraphQL. Before it was just: some-page now it is /some-page/.
Secondly in the page template creation process the theme was using the uri, therefore, this messed up the paths for the template files. This has been switched to page.slug instead now and some extra checks, to make sure the frontPage is not ending up producing a wrong path.
The master branch of the starter theme have been updated.

How does CakePHP 3 build the cakephp-plugins.php file?

I'm having some issues installing and configuring a plugin, and I think if I had a better idea of how things worked I might be able to figure it out?!
When I install the cakemanager/cakephp-settings plugin via composer it adds to my vendor folder a 'cakemanager' folder with 3 sub-folders: 'cakephp-settings', 'cakephp-utils' (a dependency) and 'Settings'. The 'cakephp-settings' folder is essentially empty, and all the plugin files are in the 'Settings' folder.
However, when I try to run the migrations I get an error that it cant find the /vendor/cakemanager/cakephp-settings/config/bootstrap.php file - no small wonder as this file doesnt exist! Same error pretty much everywhere in my application
In the vendor/cakephp-plugins.php file I have this:
'Settings' => $baseDir . '/vendor/cakemanager/cakephp-settings/',
If I temporarily change this to
'Settings' => $baseDir . '/vendor/cakemanager/Settings/',
I can get the migrations done and my pages look normal again, however this reverts when I run composer dumpautoload and causes further issues down the track - I need a permanent solution.
How do I edit the plugin (composer.json files?) so that it builds the cakephp-plugins.php file correctly and it looks in the correct path for the bootstrap.php file?
I would suggest that you try to push merging this pull request, as that will fix the problem at its root, the installer-name option in the plugins composer.json will cause the target folder to be named "incorrectly" in case composer/installers is installed.
There is no reason to change the folder name, and as of Version 3, CakePHP doesn't need composer/installers anymore, so removing the option should fix the problem.
You could also try to remove composer/installers if you don't actually need it. In case that isn't possible, you should also be able to work around the problem by specifying the actual path via the Plugin::load() calls path option:
Plugin::load('Settings', [
'path' => ROOT . DS . 'vendor' . DS . 'cakemanager' . DS . 'Settings'
]);
It may also be worth reporting the problem to https://github.com/cakephp/plugin-installer and/or https://github.com/composer/installers, maybe it's possible to get them working together with respect to the installer-name option.
See also
API > \Cake\Core\Plugin::load()

Errors in Routes requests

im working in a project using angularjs and laravel, but i have a bug i think in my application, im not sure since it happens sometimes, not always. Basically when i open or run my application are made some requests to some routes, but sometimes give me a 500 error, and than the error that is shown in the preview is:
RuntimeException in ApiServiceProvider.php line 88:
Unable to boot ApiServiceProvider, configure an API domain or prefix.
I searched online this error and didnt find much info related with this error, does someone have a idea what could it be?
Yes I have solved the problem, the thing is that you are missing configurations.
The way to solve it you have to make a copy of .env.example file and rename it to .env
Do not forget to change you database configurations.
The problem was missing domain or prefix. which is in your case is:
API_PREFIX=api
I`m sure that it should solve your problem.
Helpful hint turn on your debugging environment in config/app.php to 'debug' => env('APP_DEBUG', true)
so you can be more specific with error messages.
I had same problem even if API_PREFIX was set in my .env file.
Simple solution that I found after long struggle was to clear cache:
php artisan chache:clear
php artisan config:cache

CakePHP searching for DebugKit at wrong path

I am trying to import DebugKit and CakePHP is producing the following error: DebugKit.ToolbarComponent could not be found.
Right below it, it says:
Create the class ToolbarComponent below in file:
/Users/SomeUser/Sites/SomeProject/app/Plugin/DebugKit//Controller/Component/ToolbarComponent.php
If you notice though, there are two slashes between DebugKit and Controller for some reason, and that's obviously not a real directory. The server running PHP 5.4.17. I have followed the exact installation instructions listed here. Any suggestions?
I had the same problem and solved it by changing the permissions to 755 to folders within DebugKit.
When I encountered this problem, I realized I had a Plugin/DebugKit folder structure in my project's root, and under the app directory. The one under app was empty, save for a blank file called empty. Strange. I have no idea how this happened. (Perhaps from accidentally running composer as non-root?) I deleted app/Plugin/DebugKit, and moved the one from the project root into app. No more error.
DebugKit does not currently seem to be compatible with cakephp 3.0 even though it is the example in the documentation.
The latest version still seems to use the 2.x methods.
I will also submit a ticket regarding this to update their documentation to prevent confusion.
If there is something I missed regarding this issue and it is actually possible to install this, let me know.

How to prevent Joomla site creating unwanted folder

I have a menu link with the alias "inside" on a joomla 3.1.5 site here: http://naiwellness.com
Every morning I check the site and a folder named "inside" has been created in the root dir which prevents the site from loading as it should, instead displaying a directory contents listing at http://naiwellness.com/inside
Anyone have any ideas how to prevent this please?
Thanks
This is just a theory, but check the xml files of your installed modules and plugins (most likely a plugin) for this line...
<folder>inside</folder>
and if it exists try deleting that line of code - or better still uninstall the extension - that should fix it. It's possible that a plugin requires that folder and has php code to create the folder if it doesn't exist - and so creates the folder each time it is run - i.e. when the site is loaded. The above line of xml code I have asked you to look for will go someway to helping determine if this is the case.

Resources