php artisan ninja:update-key

Hello! I got this message on my selfhosted server today. What do i do?

Message:
Error: APP_KEY is set to a default value, to update it backup your database and then run php artisan ninja:update-key

Has anything changed/did you recently upgrade?

If you have SSH access to the box you can run the command from the project folder.

I’m running into this on a new install on my dashboard. I will make the assumption that “project folder” means Invoice Ninja’s root folder. When I run:

php artisan ninja:update-key

I get:

 php artisan ninja:update-key
X-Powered-By: PHP/4.4.9
Content-type: text/html

<br />
<b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1 in <b>/homepages/39/d795196188/htdocs/htdocs/ninja/artisan</b> on line <b>34</b><br />
<br />
<b>Parse error</b>:  syntax error, unexpected T_STRING in <b>/homepages/39/d795196188/htdocs/htdocs/ninja/artisan</b> on line <b>34</b><br />
(uiserver):u98307103:~/htdocs/ninja$

Perhaps it needs to be run somewhere else?

To answer my own question, I needed to specify the version of php to run. For 1and1 hosting service this meant:

php7.3 artisan ninja:update-key

Hope this helps someone.

php artisan key:generate

generate a key with this command line.
Ninja will give you a demo key. You should update it.