fileinfo PHP扩展未安装在真实服务器中

have a problem of my excel file uploading. code is working perfectly in my localhost but not in the real server. this is my controller code:

class UploadController extends \yii\web\Controller
{
  public function actionIndex()
{
    $model = new UploadForm();
    if (Yii::$app->request->isPost) {
        $model->excelFile = UploadedFile::getInstance($model, 'excelFile');
        if ($model->upload()) {
            $query = Yii::$app->db->createCommand('SHOW TABLES FROM reporting')
                                                    ->queryAll();
                if ($query==null) {
                    $nodb="no";
                    return $this->render('index',['model' => $model,'nodb' => $nodb,]);
                }else{
                    $this->redirect(URL_FOLDER.'backend/controllers/import.php?filename='.$model->excelFile.'&dbname='.DB_NAME);
                }
        }
    }
    return $this->render('index',['model' => $model,]);
}

}

end this is my models code:

class UploadForm extends Model
{
/**
 * @var UploadedFile
 */
public $excelFile;

public function rules()
{
    return [
        [['excelFile'], 'file', 'skipOnEmpty' => false, 'extensions' => 'xls'],
    ];
}

public function upload()
{
    if ($this->validate()) {
        $this->excelFile->saveAs('uploads/' . $this->excelFile->baseName . '.' . $this->excelFile->extension);
        return true;
    } else {
        return false;
    }
}
}

i tried with solution in the duplicate question but it was not helpful, and can't found the php.ini in the real server

my solution to that is : in home page of cPanel go to : logiciel => select PHP version and a list of extension diplay to you, you can select what you need like that: enter image description here

I think your folder on web server has not write permissions. Give write permissions to that folder where you need to store file.

Also you can use settings in php_ini to set errors on.

syntax is

ini_set("display_errors","On");

this will retrun errors. My coding practice says before final deployment use

ini_set("display_errors","On"); to see all errors and one done final

deployment ini_set("display_errors","Off"); for disable display of errors.