PHP Core Error – yii\base\ErrorException Directive 'register_long_arrays' is no longer available in PHP

I intermittently get this error in my application on server. Is there any way to fix this issue from the application side? Or removing the ‘‘register_long_arrays’’ reference from php.ini is the only way to get rid of this error?

Attached is a screenshot of the error.

6604

sc.png

You could downgrade PHP on the server but this would be stupid and Yii 2 requires 5.4 anyway.

Remove this directive.

If you don’t have access to php.ini you can always try to use .htaccess like


php_flag register_long_arrays Off

I placed the same in my ‘.htaccess’ which is in app/backend/web/ folder. But still it is giving me an error.

The question is why is this directive in your php.ini? What version of PHP have you got?

I have just realised that if the directive is deprecated you can not set to Off - you have to remove it completely. Am I right?

I guess so! Since I use a shared hosting, I don’t have access to edit php.ini. I think we need to completely remove the reference to it.

Maybe run requirements.php file from your Yii folder if you have not done this so far on the server in question and see if everything is ok there.