Update fails because routes-v7.php ⚠

Hi @hillel

So I just attempted to update and this is a new error I never seen before:
Updated several times in the past now flawlessly, but this time it is trolling me.

Also notice that this error flashes by very fast, so it is hard to see it. I had to run the update several times to screenshot it. :scream:

Please kindly advise.

Thanks in advance. :smiley:
Kind regards

Probably a permission/ownership issue. Have you run php artisan optimize as root instead of www-data?

find /path/to/invoiceninja \\( ! -user www-data -o ! -perm -644 \\) -ls

should probably also throw bootstrap/cache/config.php

1 Like

Thanks for the suggestion @xoo

If it was permission issue then I would have been able to run the last 10-15 former/previous updates in the past… :smiley::thinking:

Please do correct me if I am incorrect in my assumption.
Kind regards

Can you execute the find command and tell us what you get? (Assuming www-data is the user your nginx/apache is running as.)

I can only speculate about the cause, but running php artisan optimize as root will recreate bootstrap/cache/routes-v7.php (and bootstrap/cache/config.php) and is one way to end up with those files owned be root.

1 Like

Should the command be executed exactly like be below with the brackets too? (On the Ninja folder)
( ! -user www-data -o ! -perm -644 \\) -ls

I’m not a super user of Linux, still learning. :wink:
Kind regards

Still stuck with this issue. I would appreciate any help, thanks.

Kind regards

The command is

find /path/to/invoiceninja \( ! -user www-data -o ! -perm -644 \) -ls

What it does is:

  • find all files
  • beginning at your invoice directory (you need to use your real path here)
  • the backslash is needed to escape the opening and closing parenthesis from the shell
  • the parenthesis are needed to execute logical OR (-o) before the (implicit) logical AND just before the -ls
  • search for files that are ( NOT owned by www-data (change, if your nginx or apache runs as a different user) OR that have NOT ALL the permission bits 644 set ) AND list them

man find has a full man page on find

1 Like

Thanks @xoo .

Not 100% certain what i am doing wrong here:

But as I mentioned I am no super Linux user so I do not know all Linux shell commands and syntaxes etc.

Thanks in advance.
Kind regards

I have checked on my server through webmin (which I have installed too in the past to make it a bit easier to do maintenance tasks etc.) and all folder and files are from what i can see owned by www-data which I know I had set in the past to own the www root folder of ninja and its subfolder /files too when i installed Invoice Ninja.

I’m thinking of where that “routes-v7.php file” actually reside in the folder structure of invoice ninja? I been searching for it, but I cannot seem to find it.

I have also downloaded a fresh set of installation files, unzipped it to a local folder and search that for “routes-v7.php”, but nothing found there either…

So I’m a bit puzzled of it (of the location of "routes-v7.php").

Thanks again. :smiley:

Kind regards

So after been digging a bit further I have figured out that the “routes-v7.php” is automatically generated by the laravel framework in the → bootstrap → cache folder.

But on my server there is no such file:

Folders have 750 permission
Files have 644 permission.
All folder and files are owned by the www-data user.

Also I have changed bootstrap and storage (including their subfolders), to 755 as per recommendations in the documentation:


Thanks in advance
Kind regards

I’ve solved the issue and my server is now running latest version of Invoice Ninja.

Kind regards

1 Like

So was the problem with the file permissions on the routes-v7.php file?
I am seeing the same thing. The routes file is set to 644 and owned by me, but when I change the authorizations to 755, it gets set back to 644 within minutes (by a yet unidentified force).

Doesn’t sound normal @Francesco it should not change file/folder permissions automatically by itself.
Have you checked your server for security breaches/have you been hacked? :thinking:

If you have been breached contact Adrian at Magefix which can identify the issue and clean it for you:

Kind regards

Thanks. The authorization thing was resolved. I ran the artisan optimize every 10 minutes because I thought that was a good idea and I don’t know wtf I’m doing in the first place.

Still curious about the required authorizations. I understand that read rights should be sufficient, but now that I stabilized execution permission, my frequent errors have magically and quite coincidentally disappeared.