cron kohana 3.3 wrong parametr in cli - php

I am getting this error
Parameter Errors:
uri - uri is not a valid option for this task!
but my command looks valid:
php /var/www/public_html/index.php --uri=controller/action
i tried also (direct in this folder)
php index.php --uri=controller/action
php index.php --uri="controller/action"
always this error
greetings

Kohana 3.3 changed the way it handles CLI execution. From 3.3 it uses Minion module and --uri param is dropped in favour of --task, therefore you have to create Tasks (as opposed to Controllers).
More in the docs: http://kohanaframework.org/3.3/guide/minion/tasks
Note that docs have an error, there's no $_defaults any more, there's $_options instead. Have a look into API Docs for more details.

Related

template inheritance of overrided bundle

I am using symfony 3.4, but planning to update 4.0 in future.
So I reduce the bundle override step by step. ( it is prohibited in symfony 4)
For now I am planning to use template override in templtes directoly.
So I made the file here.
/templates/bundles/ApplicationSonataMediaBundle/Form/media_widgets.html
then cache clear
php app/console cache:clear
However it doesn't work.
My error messages are like this below.
Unable to find template "ApplicationSonataMediaBundle:Form:media_widgets.html.twig"
(looked into: /Users/whitebear/CodingWorks/httproot/myapp/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views,
/Users/whitebear/CodingWorks/httproot/myapp/app/Resources/views,
/Users/whitebear/CodingWorks/httproot/myapp/templates,
/Users/whitebear/CodingWorks/httproot/myapp/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form).
Where should I check next??
your error message suggests, you have a call
$this->render('ApplicationSonataMediaBundle:Form:media_widgets.html.twig');
somewhere (plus parameters). That syntax isn't used anymore, instead use:
$this->render('#ApplicationSonataMediaBundle/Form/media_widgets.html.twig');
as shown in the Symfony templating docs (it appears this changed from symfony 3.1 to 3.2, if the docs can be trusted).

Fatal error: Call to undefined function httppost()

I am trying to make a project work. But I am getting an error like this:
Class 'App' not found in /var/www/html/project/test.php on line 4
line 4 of this file says:
app::$activepage = $_GET['_page'] ? httpget('_page') : $_POST['_page'] ? httppost('_page') : 0);
I am using cakePhp Version: 1.3.15-1.
The weird thing is that when I do apt show cakephp it says State: not installed
However, I have followed all the instructions of https://www.digitalocean.com/community/tutorials/how-to-install-cakephp-on-an-ubuntu-12-04-vps and when I open the index.php file of cakephp, it doesn't indicate any errors.
As I said in my Comment:
Your snippet / folder structure doesn't look like CakePHP.
Part of the problem may be a version mismatch. You say you're using version 1.3.15, but the tutorial on installing it that you link was created over a year later and references version 2.3.9. It looks like the general steps are the same, based on comparing your tutorial to the steps in the 2.X blog tutorial. You might have more luck with an older tutorial on using CakePHP on Ubuntu. Most of the steps look similar, but there are some differences with the .htaccess portion that could be causing the problem. Neither the 1.3 or 2.3 versions look like they require any "installing."
If you're not looking at the older version for any particular reason, of course it's best to use the most recent version of CakePHP, but I assume you have a particular reason for using that version. But if you're stuck, you might try a newer version to see if it gives the same errors.

Proxy is empty after initializing successfully

I'm using the PECL D-Bus extension with PHP 5.5 on Ubuntu 14.04 to interract with Clementine.
As for now I'm able to connect to the session bus (exceptions are throwns when any error occurs), but when I initialize the proxy object I get an empty DbusObject, so I'm unable to call the D-Bus methods.
Here is the code I use (inspired from the extension usage examples) :
$dbus = new Dbus(Dbus::BUS_SESSION);
$clementine_player_proxy = $dbus->createProxy('org.mpris.clementine', '/Player', 'org.freedesktop.MediaPlayer');
var_dump($clementine_player_proxy); // returns "object(DbusObject)#3 (0) {}"
Of course I checked with d-feet if the bus name, the object path and the interface exists :
I'm stuck for two days.
Edit : submitted bug on the PHP bugreport.
Edit 2 : tested with another method (Addtrack(string, bool)) with another object path (/TrackList). It works. I don't understand.
I ended up to learn Python to properly use D-Bus with ease via the dbus module (as said in the Clementine's wiki).
I recommend to everyone who wants to use the PHP D-Bus extension to not do so : it is buggy, tricky and it has no documentation (except example scripts).

Sonar and PHPMD: how to exclude directories

I'm trying Sonar and i've got some issues with it for a php project.
I have to do it multi-module to get at least php and js analysis.
this is my sonar-project.properties:
sonar.projectKey=xxxx
sonar.projectName=xxxx
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=
sonar.language=php
sonar.exclusions=htdocs/libraries/externals/**
sonar.phpCodesniffer.skip=true
sonar.modules=php-module,js-module
# PHP module
php-module.sonar.projectName=PHP Module
php-module.sonar.language=php
php-module.sonar.sources=
php-module.sonar.projectBaseDir=htdocs
php-module.sonar.exclusions=libraries/externals/**
# JavaScript module
js-module.sonar.projectName=JavaScript Module
js-module.sonar.language=js
js-module.sonar.sources=js
js-module.sonar.projectBaseDir=htdocs
But when i run sonar-runner, i get this error:
Exception in thread "main" org.sonar.runner.RunnerException: org.sonar.api.utils.SonarException: PHPMD execution failed with returned code '1'. Please check the documentation of PHPMD to know more about this failure
and the PHPMD error is
The parser has reached an invalid state near line "32" in file "/var/www/vhosts/dev3.xxxx.local/htdocs/libraries/externals/AvaTax4PHP/classes/ATConfig.class.php". Please check the following conditions: The keyword "parent" was used as type hint but the class "ATConfig" does not declare a parent.
But why is that happening if i've excluded the dir libraries in the project and the module?
Do i have to specify to PHPMD another list of exclusions?
For PHPMD (just as for PHP CodeSniffer, for example) you will have to specify a separate exclude pattern. You can use PHPMD's --excludeparameter for that.
Took me a while to figure it out, but you can set PHPMD's command line parameters with the following setting in your sonar-project.properties file:
sonar.phpPmd.argumentLine=--exclude libraries/externals
You can refer to this FAQ entry to know how to achieve your goal: http://docs.codehaus.org/display/SONAR/PHP+Plugin+FAQ#PHPPluginFAQ-HowdoIpreventexternaltoolsfromanalyzingsomesourcefiles
BTW, you should declare:
php-module.sonar.sources=.
, instead of:
php-module.sonar.sources=

Kohana -- Command Line

I'm trying to "faux-fork" a process (an email being sent via SMTP) in my web application, and the application is built on Kohana.
$command = 'test/email';
exec('php index.php '.$command.' > /dev/null/ &', $errors, $response);
I'm getting an error --
Notice: Undefined index: SERVER_NAME
When I look into Kohana's index.php file, I see that it is looking for a variable named SERVER_NAME, but I guess it is coming up NULL because Kohana couldn't detect this value and set it prior to run.
Any ideas how to get Kohana to run via command line?
After looking into Kohana3 source code, I found that it has support for cli (system/classes/kohana/cli.php). You can pass 3 options (uri, method, get, post). So:-
$ php index.php --uri="items/list"
would call the list method in Controller_Items.
As far as I know you can't run the kohana files directly in command line because of its bootstrap methods.
You could do 2 things:
export all command like functions outside kohana and run them independently.
Something else you could do is running it trough the index.php located in the kohana main folder while passing the $controller, $method variables to it so it ends up at the right object where your code is located:
For kohana 2:
php index.php controller/method/var1/var2
Kohana 3
php index.php --uri=controller/method/var1/var2
Edit:
Kohana has a great CLI task runner from version 3.3 onward as official module. For version 3.2 it's still an unofficial module. I suggest you use these because they give a lot of extra options on running from CLI:
Kohana 3.2 - https://github.com/Zeelot/kohana-minion
Kohana 3.3 - https://github.com/kohana/minion
And Kohana2 is just php index.php controller/method/param1/param2/etc
Kohana was built to run on the CLI as well as web.
If you are using Kohana 3 then you can run it from the terminal.
Example
php index.php --uri=controller/action
Options
--uri
--method
--get
--post
For Kohana 3, check out these docs and source.
I had a similar issue
Did you or anyone add the SERVER_NAME to the index.php file?
If so either remove the code outside the index.php (and or bootstrap) OR you can wrap it it in a
if (PHP_SAPI === 'cli')
{
// ...
} else {
//....
}

Categories