Install Invoice Ninja v5 on Shared Hosting w. Cpanel

I have followed the instruction Free Source Available Invoicing, Expenses & Time-Tracking | Invoice Ninja

Everything works fine until Add cron job.

Instruction says /opt/alt/php73/usr/bin/php /home/myuseraccount/public_html/artisan schedule:run

cPanel cron jobs gives a General example:
/usr/local/bin/php /home/myuseraccount/public_html/path/to/cron/script

and a Domain-specific example:
/usr/local/bin/ea-php99 /home/myuseraccount/domain_path/path/to/cron/script

My site and artisan is installed to /home/myuseraccount/portal.domain.info/artisan schedule:run

Regardless of what prefix or path i enter I just cant seem to get the cron job running and Dashboard displays the error below.

PHP set to 7.4

image

No error in laravel.log

What am I missing?

Hi,

Do you mean to have the double slashes after home (/home/ vs /home//)

If you have SSH access it would be helpful to try running the cron from the command line to check for errors.

Sorry the < > commented out myuseraccount, I have edited the description of the problem

Any feedback on the cron job :thinking:

@david, @ben any ideas?

@IgnorantNinja

Can you advise whether there are any errors in the logs that look like this

 development.INFO: latest version = 

Only this in laravel.log
Any other log to check?
Permission issue?

image

These cron jobs, ideas, anyone?

Sorry, without SSH access I’m not sure how to debug the problem.

@david, any thoughts?

I have v4 installed on the same server and cron is working with /opt/alt/php72/usr/bin/php /home/myaccount/invoice.mydomain.com/artisan ninja:send-invoices

Is php version relevant for artisan cron in v5?

That could be the problem, I believe v5 requires PHP >= 7.3

Recap.

PHP reports 7.4.15

image

Terminal reports 7.4.15

image

Invoiceninja v4 installed on same server and cron is working with /opt/alt/php72/usr/bin/php /home/“user”/invoice.“domain”.com/artisan ninja:send-reminders

image

cron job set to run every minute!

v5 on same server trying with /opt/alt/php72/usr/bin/php /home/“user”/portal.“domain”.info/artisan schedule:run
cron daemon reports: Composer detected issues in your platform:
Your Composer dependencies require a PHP version “>= 7.3.0”. You are running 7.2.34.

Corrected path to /opt/alt/php73/usr/bin/php /home/“user”/portal.“domain”.info/artisan schedule:run

First run reports:
Running scheduled command: ‘/opt/alt/php73/usr/bin/php’ ‘artisan’ queue:work > ‘/dev/null’ 2>&1
Running scheduled command: ‘/opt/alt/php73/usr/bin/php’ ‘artisan’ queue:restart > ‘/dev/null’ 2>&1
Running scheduled command: App\Jobs\Util\SchedulerCheck
In Connection.php line 678:
could not find driver (SQL: select * from information_schema.tables where t
able_schema = user_dbname and table_name = accounts and table_type = ’
BASE TABLE’)
In Exception.php line 18:
could not find driver
In PDOConnection.php line 38:
could not find driver

Second run reports:
Running scheduled command: ‘/opt/alt/php73/usr/bin/php’ ‘artisan’ queue:work > ‘/dev/null’ 2>&1

The dashboard still reports “The crons need to be enabled”

The cron configuration as described in the self host documentation was working all along.

I was thrown of by “The crons need to be enabled” and the “refresh data” seemingly not updating the dialogue.

Is there a problem with the dialogue or am I doing something wrong?

image

I hope this is helpful finding a solution and perhaps saving someone the hassle.

And thanks for the effort from @hillel and @david

I forgot to disclose that I set PHP 7.3 in the directory using .htaccess, hence the path to /opt/alt/php73 /usr/bin/php

image

n Connection.php line 678:
could not find driver (SQL: select * from information_schema.tables where t
able_schema = user_dbname and table_name = accounts and table_type = ’
BASE TABLE’)
In Exception.php line 18:
could not find driver
In PDOConnection.php line 38:
could not find driver```

it looks like you are missing the PHP MYSQL/PDO driver for the selected PHP version you are using.

Notes for shared hosting PHP 7.3 and cron job w. cPanel

I need PHP 7.4 for another site and don’t have the Multi PHP Selector so i AddHandler for PHP 7.3 in ninja/public/.htaccess

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
    AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Use the following path for the cron job

/opt/cpanel/ea-php73/root/usr/bin/php /home/"user"/"domain"/artisan schedule:run

v5 cron job on first run.
FYI it seems the cron needs to run a few times on a fresh install before it stops showing error in dashboard, this can complicate things for a noob like myself when the cron is set to run only once every 24h.

I set the cron to run every minute and the cron emails looked as follows.

1st & 2nd
image

3rd
image

4-6th run
image

7th and the error is gone.
image