Permission Issue

Hey I’m getting the following permission error after upgrading the newest edition:


routes-v7.php is not writable

Is anyone able to help me?
I ran the following commands but it didn’t help:

sudo chown -R www-data:www-data /var/www/html
sudo find ./ -type d -exec chmod 755 {} \;


@david any ideas?

hey, also experiencing an issue with PDF generation: any PDF’s emailed as an attached are corrupted.
and if anyone try’s to view a PDF online it shows the following error:

{“message”:“Unable to generate the raw PDF”}

@SecureCPU According to other topics on the forum here, that is due to the artisan command being run as a different user and NOT as www-data.

That could possibly be the situation with your PDF problem as well. Have run the Health Check to see if PDF generation is enabled correctly? Are you using snappdf?


This is the health check.

1 Like

How do I fix the artisan permission issue?
is it something to do with the cronjob file?

I also updated the php to 8.2 during this update? Would it have anything to do with that?

When I have it set to
the PDF works. when it set to snappdf it doesn’t work.

Yes, it might. If your cron jobs were setup with your regular user and not your www-data user, then that’s definitely going to cause issues.

Yes, the PHP update could be causing problems. Did you purge the previous version after updating to 8.2? Did you update your .env file to reflect the new version? Did you update your cron jobs to reflect the new version?

That sounds like you may not have snappdf configured correctly. I think you’ll find it works better than hosted_ninja. At least I know that I did.

According to your Health Check, you would seem to have snappdf enabled correctly.

How can i make sure that the correct php is inserted where it needs to be?
How do i purge the old php?
How do i fix the php permissions?

Well, you would need to check the various locations. For example, use the steps you previously used to setup the cron job. If you edit your crontab with your www-data user and it doesn’t have anything configured, then you know that was edited with the regular user. You would then need to create the cron job with your www-data user and delete the duplicate ones with your regular user.

For example, the following is what my crontab looks like:

0 8 * * * /usr/bin/php8.3 /var/www/invoiceninja/artisan ninja:send-recurring > /dev/null
0 8 * * * /usr/bin/php8.3 /var/www/invoiceninja/artisan ninja:send-reminders > /dev/null
* * * * * cd /var/www/invoiceninja/artisan && /usr/bin/php8.3 artisan schedule:run >> /dev/null 2>&1

You can see from the above, that I am using PHP8.3. You should make sure yours is set for PHP8.2 (if that’s what you are using).

If you are using nginx, you should make sure that it is referencing your correct version of PHP in the nginx config file. It’s been a very long time since I have used apache2, so I don’t remember if there is a PHP reference there. As @hillel often recommends, you could also create a temporary php info page to check which is being used.

I correct my previous message. There is no reference to the PHP version in your .env file. I’d remembered that incorrectly.

Well, if you are running on Ubuntu/Debian the recommended way is as follows. Use at your own risk and only if you know what you are doing!! I assume no responsibility if you are unfamiliar with the following.

sudo apt purge php8.1
sudo apt autoclean
sudo apt autoremove

You can also run either (or both) of the following to see what php is installed (or at least might be installed). There are many way to do this, these are just two simple ways.
ls -la /etc/php
apt search php
The latter will list every single package related to php in the Ubuntu/Debian repositories, so there may be a lot to scroll through. When you scroll through the list you should see something similar to below, but for the versions of PHP on your machine. It may require a lot of scrolling to get to PHP8.1 or PHP8.2. You could also just list your installed packages apt list --installed and scroll up to PHP. You should see something to the following if it is installed on your machine.

php8.3/noble,now 8.3.6-0maysync1 all [installed]
  server-side, HTML-embedded scripting language (metapackage)

Don’t worry about permissions right now. Make sure those things are fixed first. There may be other locations that should be checked, but that is what I remember at the moment. If you do have snappdf installed, make sure you go through the InvoiceNinja directions carefully to ensure it’s installed correctly.

Isn’t the PHP bin file php82 or php83 without the dot?

Same permission issue here. I’m using InvoiceNinja on Cloudron so I can’t modify any of the files :frowning:

I also can’t send invoice/quote emails to clients. I do get the notification email that the email has been sent to the client from IN to my admin email. Sadly, the actual invoice does not get delivered to the client. I tried multiple providers in case one provider was blocking my IP/domain.