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
<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 />
<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.