First of all thank you for this forum. It’s very usefull!
I had to execute a shell php (like as $>php ./test.php) and I find the RunActions extention, but I don’t understand how to use it.
In my controller, I create a new method and put in this code
public function actionTest()
Yii::log('Starting background task...');
//Inform the user if 'hasFlash' is implemented in all views
Yii::log('Background task executed');
To test it, the code testaction.php, open and write into a log file.
I checked on application.log, but I didn’t find any errors, so I don’t understand where is the problem.
have any suggestion to solve it?
Thank you for your reply.
I’m checking your suggestion.
But I don’t understand why I cannot use the ERunActions. In particulary, I don’t understand why it doesn’t this if.
My goal is
Click on button
execute a .php (without parameter). The .php is on another server, but I have the permission to execute it
Return to the user a message, when the .php ends. (note: Only one admin user will use this procedure)
Am I following you correctly that you like to execute script like a cron and then user should be notified?
In this case:
has no use. It sets the flash into session where the script is being executed from. It is not a "superglobal" variable or how is it called properly. Maybe better idea, is to change value in users sql, and if condition is reached the setflash is called(when user browses something).
But the goal is easily reachable with Yii command line. It runs perfectly over ssh (./yiic). I can’t say why the ERunActions is not working, you can debug it with var_dumps or die’s to see how far the code is beign executed.