After Upgrade php 8, cron need to be enabled

After the last upgrade I was forced to install php 8 and uninstall php 7

i run
sudo apt-get purge php7.*
sudo apt-get autoclean
sudo apt-get autoremove


sudo apt install php8.1-bcmath php8.1-ctype php8.1-fileinfo php8.1-gd php8.1-json php8.1-mbstring php8.1-openssl php8.1-PDO php8.1-tokenizer php8.1-xml php8.1-curl php8.1-zip php8.1-gmp php8.1-mysql

…i received this message

Note, selecting ’ php8.1-common’ instead of ‘php8.1-ctype’
Note, selecting ‘php8.1-common’ instead of ‘php8.1-fileinfo’
Note, selecting ‘php8.1-pdo’ for glob ‘php8.1-PDO’
Note, selecting ‘php8.1-common’ instead of ‘php8.1-pdo’
Note, selecting ‘php8.1-common’ instead of ‘php8.1-tokenizer’
Package php8.1-json is a virtual package provided by:
php8.1-phpdbg 8.1.8-1+0~20220711.23+debian11~1.gbp5e9cbc
php8.1-fpm 8.1.8-1+0~20220711.23+debian11~1.gbp5e9cbc
php8.1-cli 8.1.8-1+0~20220711.23+debian11~1.gbp5e9cbc
php8.1-cgi 8.1.8-1+0~20220711.23+debian11~1.gbp5e9cbc
libphp8.1-embed 8.1.8-1+0~20220711.23+debian11~1.gbp5e9cbc
libapache2-mod-php8.1 8.1.8-1+0~20220711.23+debian11~1.gbp5e9cbc
You should explicitly select one to install.

E: Package ‘php8.1-json’ has no installation candidate
E: Unable to locate package php8.1-openssl
E: Couldn’t find any package by glob ‘php8.1-openssl’

but when i run php -v

Screenshot 2022-08-04 103656

after that invoiceninja shows


but if I run

sudo -u www-data crontab -e

Screenshot 2022-08-04 103248

i restart the computer and also i run

sudo -u www-data php artisan optimize
sudo -u www-data php artisan queue:flush
sudo -u www-data php artisan queue:restart

just in case

what can i do?


What do you see if you try calling the cron manually by running:

php artisan schedule:run


Screenshot 2022-08-04 111246

@david do you have any suggestions?

not sure, you could try defining the exac path the php8.1 in the cron, ie: /usr/bin/php81

it didn’t work!

Screenshot 2022-08-04 193004

the cron may need to be /usr/bin/php8.1

please note, there may be nothing scheduled to run yet.

the app only shows


there’s nothing else i can do

…I don’t quite understand what you want to tell me… do you mean this?

…i dont knows nothing about php

change the cron back to just php

then, create a recurring invoice as a test to send today. on the hour, it should send. I think the message you are seeing may not resolve itself for ~24hours until the check runs again.

I cant do nothing with the app

I’m frustrated

Some of the PHP 7 modules are rolled into common on version 8. The following installation line worked for me.
sudo apt install php8.1 php8.1-{common,fpm,bcmath,mbstring,xml,curl,zip,gmp,gd,mysql}

I think your cron for www-data (sudo crontab -u www-data -e) should look more like this. Ignore the single quotes that were used to format it for posting here.
‘* * * * * cd /var/www/invoiceninja && php8.1 artisan schedule:run >> /dev/null 2>&1’

I am using Ubuntu 20.04 but this should work for Debian 11. I have a feeling that the missing period in php81 and not being run in the Invoice Ninja directory is the problem.

thank you for your answer,
You are correct regarding the point in the cron, also i check to have the packages you mention installed, but unfortunately it still does not work

Looks like Debian 11 with Apache which I haven’t tried but are you sure that your cron is cd’ing into the invoiceninja folder first? Running it as ‘php8.1 /var/www/invoiceninja/artisan’ doesn’t work on Ubuntu at least.

Maybe your www-data cron should look like the following minus the single quotes.
‘* * * * * cd /var/www/invoiceninja && /usr/bin/php8.1 artisan schedule:run >> /dev/null 2>&1’

I tried what you recommended, and didn’t works but when trying to enter using the browser it opened the default page of Apache 2.

Must be something wrong in the apache config but I don’t know where to look. I do remember running ‘sudo apt-get purge php7.*’ which nuked several apache packages. I was curious why it did that even though I wasn’t using apache so I reverted to a previous snapshot and didn’t run that command again. Using the instructions here gave me some guidance at the time. Maybe check this too for the Apache config.

I remembered that I had configured nginx when I installed invoiceninja a long time ago, with the update just copy and paste what the guide said and surely install apache by mistake, uninstall it and everything went back to normal.
Thank you all very much for helping me

1 Like