Shared Hosting - Installing 4.5.7


I am trying to install version 4.5.7 on a shared server. I have followed instruction from the invoice ninja website and also from laravel tutorial, since I understand that invoice ninja is a fork from laravel.

the directory structure looks ok, permissions look ok, database has been created and .env file has been configured.

However, I get a php error:

Parse error: syntax error, unexpected ‘as’ (T_AS), expecting ‘,’ or ‘)’ in /home/kolib/domains/ on line 39

Apparently the following code is at fault:

            foreach ($map as $namespace => $path) {
                $loader->set($namespace, $path);

            $map = require __DIR__ . '/autoload_psr4.php';
            foreach ($map as $namespace => $path) {
                $loader->setPsr4($namespace, $path);

The web admin at the hosting company believes that the ninja code is corrupt. Do you know any such problems with version 4.5.7?

Many thanks.


I’m not sure, I haven’t seen this error before.

Is there a reason you aren’t using the latest version (v4.5.9)?

Hi Hillel,

No reason in particular, this was the latest version at the time I downloaded the code. Would it make sense to use version 4.5.9 instead of version 4.5.7, Are there any significative changes?

Many thanks,


If it’s a new install I’d recommend using the latest version.

Ok, I am going to do that.

Besides that, Is there any thing I should check on top of the above mentioned point (directory structure, file permissions, database config and .env file config?)

Many thanks,


Sorry, not sure. I haven’t been able to find anything relevant on Google.

Hello Hillel,

Thanks for the endeavour, I am wondering if I need to run the following command on the server:

sudo composer install

and also:

sudo composer update
sudo composer install

This step is mentionned in the following tutorial, but it is nowhere I can see on the invoice ninja web page.

Thanks for your help!


IIRC, composer is used when you clone from the github repo. If you’re downloading the zip file, I don’t think composer is necessary. At least I think that’s how it works. Don’t quote me on it just yet.

Thanks Titanfail!

It is difficult to deploy Laravel on shared hosting because you don’t have ssh access there. This means you cannot use composer commands. This make it difficult to maintain your Laravel apps on shared hosting.

As we know that it is hard to deploy this but you can see a tutorial about laravel on WPiTech