yii2 fileinput not working - file-io

I'm new in yii2.
On my project use kartik\file\Fileinput;
In local its good working and when upload to my host get this error:
in the first of my file this :
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\file\FileInput;
PHP Fatal Error – yii\base\ErrorException
Class 'kartik\file\FileInput' not found
1. in /home/user/domains/myhost.com/public_html/modules/admin/views/photos/_form.php
at line 27 18192021222324252627282930313233343536
echo $form->field($model, 'filename[]')->widget(FileInput::classname(), [...

Try this use kartik\widgets\FileInput; instead of use kartik\file\FileInput;

Related

How do I solve fusionauth php client error 'FusionAuthClient' not found?

when I follow https://github.com/FusionAuth/fusionauth-php-client
I can see error:
PHP Fatal error: Uncaught Error: Class 'FusionAuthClient' not found ... on line 6
My application looks like this:
First application
<?php
require_once 'FusionAuthClient.php';
$apiKey = "7W-yBfeXfniDhu8PR_h0dGkSsPDJlpUYuP9rP2xXd_4";
$client = new FusionAuthClient($apiKey, "http://localhost:9011");
line 6 is last.
composer says all is right
$ composer require fusionauth/fusionauth-client
Using version ^1.6 for fusionauth/fusionauth-client
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing fusionauth/fusionauth-client (1.6.1)
Downloading: 100%
Writing lock file
Generating autoload files
FusionAuthClient.php, ClientResponse.php and RESTClient.php are in the same directory as my test script.
Can you point me into the right direction what is cause of this problem?
Have you looked at the first line of the FusionAuthClient.php file? apparently not.
namespace FusionAuth;
Therefore, the class is not in the global namespace, therefore you need to tell php which namespace it's in:
$client = new FusionAuth\FusionAuthClient($apiKey, "http://localhost:9011");
You're welcome.
That looks the require_once function path is invalid
Do have you same bug when using "require" and not "require_once"?

Opencart vqmod 2.3.0.2 $config error

i have just installed opencart 2.3.0.2 and vqmod but i am facing a problem now. In previous version of opencart when i was using the below code in vqmod xml file
global $config;
$variableA = $config->get('field_value');
then in $variableA i got the value which i saved in the db from admin section but now in 2.3.0.2 when i use this code it shows fatal error
Fatal error: Call to a member function get() on null
please tell me how can i get the value in vqmod xml file so i can use this variable further
Thanks
Define the variable in a file controller first:
$data['variableA'] = $this->config->get('variableA');
then (for example) echo the variable in a view file:
<?php echo $variableA; ?>

How do you run a Yii command from within your Module?

Is it possible to have my module's custom commands show up in the list of application commands when you run yiic?
cd {yii_protected_folder}
yiic shell {full_path_to_my_yii_protected_folder}/config/console.php
I've tried adding the command into the commandMap array in console.php, but the command never shows up as an option in yiic.
'commandMap'=>array(
'passwordtest'=>array(
'class'=>'application.modules.myModule.commands.shell.passwordtestCommand',
),
The only way I can make it show up in yiic is to copy the passwordtestCommand.php file to {yii_protected_folder}/commands/shell/, but I'd rather keep the file within my module and reference it somehow.
It's actually not that hard, the CConsoleApplication-class has a getter for the CConsoleCommandRunner. This in its turn has an "addCommands()"-function that allows you to add paths. Just open up your protected/yiic.php and change it by this:
<?php
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
defined('YII_DEBUG') or define('YII_DEBUG',true);
require_once(dirname(__FILE__).'/../yii/yii.php');
$app = Yii::createConsoleApplication(dirname(__FILE__).'/config/console.php');
$app->commandRunner->addCommands('extraCommandPath');
$app->commandRunner->addCommands('extraCommandPath2');
$app->run();
After that you no longer require the yiic.php from the framework.
That should do it.
'commandMap'=>array(
'passwordtest'=>array(
'class'=>'application.modules.myModule.commands.shell.passwordtestCommand',
),
this help me with run module command in Yii 1.x
just add it into config/console.php or your different console config file.
also change the path part ".myModule.commands.shell.passwordtestCommand"
cheer, it's working for me.

How to deploy fuelphp website to server

I'm new to fuelPHP, I developed a simple application and when I uploaded the files to my web server I got those errors :
Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /home1/tdfdf/public_html/site/site/public/index.php on line 22
Fatal error: require() [function.require]: Failed opening required '/bootstrap.php' (include_path='.:/usr/lib64/php:/usr/lib/php:/usr/share/pear') in /home1/tdfdf/public_html/site/site/public/index.php on line 44
I probably miss some configurations here. I also want to remove this "/public" from the url
Can any one help ?
I found the solution. The DIR is not defined for older versions of PHP . I changed my server settings to run on PHP 5.3 and it worked like magic.
Thanks.

Apache Problem, phpinfo gives following arror

Simply calling phpinfo(); gives the following info..
Fatal error: Using $this when not in object context in /var/www/phpinfo.php on line 2
It is a fresh Ubuntu + Apache install on Amazon EC2.
not possible, there has to be something else in the file.
<?php
phpinfo();
?>
You might be using
$this->phpinfo();
Try using simply
phpinfo();
More info here http://php.net/manual/en/function.phpinfo.php