I have a shell located in PluginName/Console/Command/FooShell.php in CakePHP 2.6.3.
I've loaded this plugin via CakePlugin::load('PluginName'); in my app's bootstrap.php.
When that plugin is in ROOT/app_name/Plugin, and I run PluginName.foo, the shell works.
When that plugin is in ROOT/plugins and I run the same command, I get an error:
The command:
C:\xampp\htdocs\site_name\app_name>php Console/cake.php -app app_name PluginName.foo
The error:
Warning Error: include(C:\xampp\htdocs\site_name\app_name\Plugin\PluginName\Console\Command\FooShell.php): failed to open stream: No such file or directory in [C:\xampp\htdocs\site_name\lib\Cake\Core\App.php, line 547]
Warning Error: include(): Failed opening 'C:\xampp\htdocs\site_name\app_name\Plugin\PluginName\Console\Command\FooShell.php' for inclusion (include_path='C:\xampp\htdocs\site_name\lib;.;C:\xampp\php\PEAR') in [C:\xampp\htdocs\site_name\lib\Cake\Core\App.php, line 547]
Error: Shell class FooShell could not be found.
#0 C:\xampp\htdocs\site_name\lib\Cake\Console\ShellDispatcher.php(200): ShellDispatcher->_getShell('PluginName.back...')
#1 C:\xampp\htdocs\site_name\lib\Cake\Console\ShellDispatcher.php(66): ShellDispatcher->dispatch()
#2 C:\xampp\htdocs\site_name\app_name\Console\cake.php(33): ShellDispatcher::run(Array)
#3 {main}
For some reason, CakePHP is fine with this plugin being in ROOT/plugins when it's serving actual webpages, but throws an error in the console.
Nothing in the shell docs or the plugin docs explicitly says that there's anything different about using plugins in ROOT/plugins, but discussion of how that directory is used is conspicuously absent from the plugin and folder structure docs. (I assume because it's implied you're supposed to implement plugins the same way, regardless of which directory they're in.)
Am I doing this wrong?
when it is in the ROOT/plugins directory you need to load it like this in ROOT/lib/Cake/bootstrap.php
App::build(array('Plugin' => array(CAKE . DS . 'plugins' . DS)));
CakePlugin::load('<plugin-name>');
Related
After updating my app from 3.9 to 4.1.4 shell scripts stopped working. Typing this bin/cake plugin assets symlink yields this error message:
PHP Fatal error: Uncaught Error: Class 'Cake\Routing\Router' not found in /var/www/releases/12/vendor/cakephp/cakephp/config/bootstrap.php:27
Stack trace:
#0 /var/www/releases/12/config/bootstrap.php(32): require()
#1 /var/www/releases/12/bin/cake.php(31): include('/var/www/...')
#2 {main}
thrown in /var/www/releases/12/vendor/cakephp/cakephp/config/bootstrap.php on line 27
I assume there is something wrong with autoloading, but I don`t know where to start with this.
It turns out I did not replace the contents of the bin folder. They have changed with the new major version of cakephp and must be replaced with the files from the app-skeleton: https://github.com/cakephp/app/tree/master/bin
I am using custom Nagios plugins for the first time and am running into this error when I create a service for the plugin.
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load.py, ...) failed. errno is 2: No such file or directory
The plugin works when I run it on the command line, however does not work when it runs within Nagios.
I followed these steps to get the plugin into Nagios
https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf
Here is what it looks like in the Nagios UI
The plugin is in the correct path: /usr/local/nagios/libexec and the resource.cfg file has the same path within it.
I tried two separate plugins, both which work on the command line, and the result is the same error.
The error indicates the file location is incorrect, however the plugin is in the specified directory and runs with no errors within that directory.
I am totally stumped and appreciate any help.
For anyone reading this, I solved the problem.
The first time I added the plugin, I forgot to add the python extension. When I updated the already created plugin, Nagios still threw the error.
Once I completely deleted the plugin and re-created it the 'file not found', error went away.
I faced a similar issue when I was trying to add a custom plugin ( I had custom plugins in ruby and python ).
The issue was the missing shebang line at the start of the script (which determines the script's ability to be executed like a standalone executable).
For example, if you have a python plugin custom-plugin.py then make sure this script has shebang at the start of script #!/usr/bin/env python3. Also if you have other scripts (ruby, bash etc.) make sure to add the appropriate path at the start of your scripts.
Also, check the path for plugins Nagios version. For my setup path was /usr/local/nagios/libexec/ and make sure your custom plugin is executable and has correct ownership permissions.
Sample custom template I used :
define command {
command_name check_switch_health
command_line /usr/local/nagios/libexec/check_snmp.rb --host $HOSTADDRESS$ --model "$ARG1$" --community "$ARG2$"
}
The above workaround worked for me.
With random files I am getting this error from the Sencha cmd Server:
[WRN] Aliased resource: file:/C:/Users/hs/Documents/Dev/App/touchApps/touchApps/app/store/ListStore.js~=file:/C:/Users/hs/Documents/Dev/App/touchApps/touchApps/app/store/ListStore.js
I also get this error from other random files.
Sencha Cmd v5.1.0.26
Sencha touch 2.4
Any ideas why? (How can I fix this?)
Thanks!
According to this thread: http://www.sencha.com/forum/showthread.php?287420-sencha-web-can-t-serve-ext-from-outside-workspace-tree%28-%29
It looks like you load the same file twice. Double check your workspace (.sencha/workspace/sencha.cfg) points to correct directory.
And make sure that your project space config (.sencah/app/sencha.cfg) doesn't point to the same directory.
Also, check what Loader's path in your app.js.
I almost managed to deploy a CakePHP-application on CentOS-server, but it still needs little configuration. I have enabled mod_rewrite in /etc/httpd/conf/httpd.conf and restarted apache-server.
Then I have put Cake core library in /home/user/cakephp-core/
I get message "500 internal error" when i try to go to this page through web-browser.
In apache-logs I found following messages:
PHP Warning: include(/$HOME/cakephp-core/lib/Cake/bootstrap.php): failed to open stream: Permission denied in /srv/www/site/public_html/main/index.php on line 96
PHP Warning: include(): Failed opening '/$HOME/cakephp-core/lib/Cake/bootstrap.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /srv/www/site/public_html/main/index.php on line 96
PHP Fatal error: CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /srv/www/site/public_html/main/index.php on line 101
it says something about "permission denied"... to whom I should give permissions and where? I gave "apache:apache" to tmp/-folder... Any ideas?
Simply read the log and try to understand it.
It pretty clearly tells you what has insufficient permissions. The linux command to set permissions is chmod. You also want to make sure, as the text already tells you, that your CakePHP core include path is correct. Double check that too.
I have moved the CakePHP installation from my development server to production server (Config file and htaccess updated).
The production server was using an older version of PHP and I have requested the host to upgrade it. After they upgraded the PHP version, the site printing the php code on the webpage (Class : /lib/Cake/core/app) .. Also it displaying a fatal error on the bottom of the page, its below
Fatal error: Uncaught exception 'LogicException' with message 'Passed
array does not specify an existing static method (class 'App' not
found)' in /xxxxxxx/lib/Cake/bootstrap.php:154 Stack trace: #0
/xxxxxxx/lib/Cake/bootstrap.php(154): spl_autoload_register(Array) #1
/xxxxxxx/app/webroot/index.php(92): include('/xxxxxxx/pu...') #2
{main} thrown in /xxxxxxx/lib/Cake/bootstrap.php on line 154
Please help..
Have you checked the PHP version has actually changed, did you check (with phpinfo())?
Apparently, CakePHP was unable to find or load the App class (/xxxx/lib/Cake/core/App.php).
It's possible that paths have changed since the update, however, (if you're using CakePHP 2.3.1) line 134 of that same file uses this to load that file:
require CAKE . 'Core' . DS . 'App.php';
If the file was not present or could not be loaded, the script should stop at that point.
To check if your paths are correct, try to debug that path;
echo CAKE . 'Core' . DS . 'App.php'; die();
If that path is correct (my guess it is, otherwise the require should have stopped the script already as mentioned above), there is something wrong with the content of the App.php file. Maybe something corrupted the file (partial upload?) or incorrect line-endings caused PHP to interpret it incorrectly.
If the page is really showing the complete source of the App class, it may be possible you're (inadvertendly) using php 'short opening tags' and this has been disabled in the new configuration <? which may be cause, for example if a space is there is a space after the <? - <? PHP
More on short opening tags can be found here:
Are PHP short tags acceptable to use?