Issue upgrading from 4.5 to 5

Hi,

I was on version v4.5.47, and I’m trying to upgrade to version 5. It says you “upload the files OVER the current ones”). I’ve done that, but I get an error:

2023/06/13 15:01:35 [error] 260647#260647: *1551274 FastCGI sent in stderr: "PHP message: PHP Fatal error: Declaration of Symfony\Component\Translation\TranslatorInterface::getLocale() must be compatible with Symfony\Contracts\Translation\LocaleAwareInterface::getLocale(): string in /home/me/web/invoices.me.co.uk/vendor/symfony/translation/TranslatorInterface.php on line 69" while reading response header from upstream, client: 81.174.134.33, server: invoices.me.co.uk, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm-invoices.me.co.uk.sock:", host: "invoices.me.co.uk"

I’m not too sure what to do? I did try the web-based update first, but it died with a 500 IS error

UPDATE: I read somewher to try this:

composer update
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires php ^8.1 but your php version (8.0.28) does not satisfy that requirement.
  Problem 2
    - Root composer.json requires spatie/laravel-data ^3.5 -> satisfiable by spatie/laravel-data[3.5.0, 3.5.1, 3.6.0].
    - spatie/laravel-data[3.5.0, ..., 3.6.0] require php ^8.1 -> your php version (8.0.28) does not satisfy that requirement.
  Problem 3
    - symfony/mailgun-mailer[v6.1.0-BETA1, ..., 6.4.x-dev] require php >=8.1 -> your php version (8.0.28) does not satisfy that requirement.
    - Root composer.json requires symfony/mailgun-mailer ^6.1 -> satisfiable by symfony/mailgun-mailer[v6.1.0-BETA1, ..., 6.4.x-dev].

I have the frontend set as 8.1, but it seems to think I’m on 8.0 when running from CLI. Is there a way to explicitly tell compose to use 8.1?

UPDATE 2: Ok, I’m getting a bit closer - I set

"config": {
    "platform": {
		"php": "8.1"
	},
      ....

}

in the composer.json file. Then I run

composer update

This worked - but I still get an error when trying to run InvoiceNinja :frowning:

2023/06/13 15:22:14 [error] 260647#260647: *1552215 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught RuntimeException: A facade root has not been set. in /home/me/web/invoices.me.co.uk/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:335
Stack trace:
#0 /home/me/web/invoices.me.co.uk/app/Exceptions/Handler.php(99): Illuminate\Support\Facades\Facade::__callStatic()
#1 /home/me/web/invoices.me.co.uk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(481): App\Exceptions\Handler->report()
#2 /home/me/web/invoices.me.co.uk/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(136): Illuminate\Foundation\Http\Kernel->reportException()
#3 /home/me/web/invoices.me.co.uk/public_html/index.php(57): Illuminate\Foundation\Http\Kernel->handle()
#4 {main}
  thrown in /home/me/web/invoices.me.co.uk/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 335" while reading response header from upstream, client: 81.174.134.33, server: invoices.me.co.uk, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.1-fpm-invoices.me.co.uk.sock:", host: "invoices.me.co.uk"

Thanks!

Andy

Hi,

v5 is a new app, you need to upgrade to the latest v4 and then use the migration tool to migrate you data/settings.

Ah ok . What was the last v4 version?

v4.5.50

https://download.invoiceninja.com/

1 Like

Thanks. I managed to get the old system back - phew! What is the process of updating? I tried uploading the 4.5.50 files to my server, and then running index.php I get:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ultranerds_inv3.password_reminders' doesn't exist (SQL: rename table password_reminderstopassword_resets)

I’m assuming there is a script I’m supposed to run?

Thanks!

I wouldn’t expect to see that error upgrading from v4.5.47 to v4.5.50, there were no database changes between the versions.

Hmm. Would it work if I just went from 4.5.47, and did an “export”, then imported into 5? Or does it require to update to the “final” version of 4.5 first?

That wouldn’t work, v4 and v5 have different format databases.

Ok thanks. I’m trying a new install now (on a different subdomain), but having issues (500 IS error). Looking in larval.log, I see:

[2023-06-14 05:24:06] production.INFO: account table not found

Am I missing a step? Maybe an install.php somewhere? I can’t see any reference to it! (I’m just navigating to the location of index.php, and was assuming it’d take me to a setup page?)

I’ve made a .env file BTW with the DB details in

It may help to run php artisan migrate to create the database table.

Thanks. That ran:


php8.1 artisan migrate
PHP Warning:  Module "gmp" is already loaded in Unknown on line 0


                                                                                                         APPLICATION IN PRODUCTION.


  Do you really wish to run this command? (yes/no) [no]
❯ y

   INFO  Preparing database.

  Creating migration table ............................................................................................................... 22ms DONE

   INFO  Loading stored database schemas.

  database/schema/mysql-schema.dump ..................................................................................................... 830ms DONE

   INFO  Running migrations.

  2022_16_12_54687_add_stripe_bacs ....................................................................................................... 19ms DONE
  2023_01_27_023127_update_design_templates ............................................................................................... 5ms DONE
  2023_02_02_062938_add_additional_required_fields_gateways ............................................................................... 7ms DONE
  2023_02_05_042351_add_foreign_key_for_vendors ........................................................................................... 0ms DONE
  2023_02_07_114011_add_additional_product_fields ......................................................................................... 7ms DONE
  2023_02_14_064135_create_react_settings_column_company_user_table ...................................................................... 11ms DONE
  2023_02_28_064453_update_designs ........................................................................................................ 2ms DONE
  2023_02_28_200056_add_visible_prop_to_companies_table ................................................................................... 5ms DONE
  2023_03_09_121033_add_payment_balance_to_clients_table .................................................................................. 6ms DONE
  2023_03_10_100629_add_currencies ........................................................................................................ 3ms DONE
  2023_03_13_156872_add_e_invoice_type_to_clients_table .................................................................................. 11ms DONE
  2023_03_17_012309_add_proforma_flag_for_recurring_invoices .............................................................................. 5ms DONE
  2023_03_21_053933_tax_calculations_for_invoices ....................................................................................... 137ms DONE
  2023_03_24_054758_add_client_is_exempt_from_taxes ..................................................................................... 135ms DONE
  2023_04_20_215159_drop_e_invoice_type_column ............................................................................................ 5ms DONE
  2023_04_27_045639_add_kmher_language ................................................................................................... 22ms DONE
  2023_05_03_023956_add_shopify_user_id .................................................................................................. 26ms DONE
  2023_05_15_103212_e_invoice_ssl_storage ................................................................................................. 8ms DONE
  2023_06_04_064713_project_and_task_columns_for_company_model ............................................................................ 6ms DONE

Now I get:

[2023-06-14 05:48:52] production.ERROR: Attempt to read property “key” on null {“exception”:"[object] (ErrorException(code: 0): Attempt to read property "key" on null at /home/ultranerds/web/invoicesnew.ultranerds.co.uk/app/Http/Middleware/ContactAccount.php:33)
[stacktrace]

Hmmm

@david do you have any suggestions?

I’m getting closer. New weird error though:

production.ERROR: RecursiveDirectoryIterator::hasChildren(): open_basedir restriction in effect. File(/home/ultranerds/web/invoicesnew.ultranerds.co.uk/logs/invoicesnew.ultranerds.co.uk.log) is not within the allowed path(s): (/home/ultranerds/.composer:/home/ultranerds/web/invoicesnew.ultranerds.co.uk/public_html:/home/ultranerds/web/invoicesnew.ultranerds.co.uk/logs:/home/ultranerds/web/invoicesnew.ultranerds.co.uk:/home/ultranerds/web/invoicesnew.ultranerds.co.uk/private:/home/ultranerds/web/invoicesnew.ultranerds.co.uk/public_shtml:/home/ultranerds/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) {"exception":"[object] (ErrorException(code: 0): RecursiveDirectoryIterator::hasChildren(): open_basedir restriction in effect. File(/home/ultranerds/web/invoicesnew.ultranerds.co.uk/logs/invoicesnew.ultranerds.co.uk.log) is not within the allowed path(s): (/home/ultranerds/.composer:/home/ultranerds/web/invoicesnew.ultranerds.co.uk/public_html:/home/ultranerds/web/invoicesnew.ultranerds.co.uk/logs:/home/ultranerds/web/invoicesnew.ultranerds.co.uk:/home/ultranerds/web/invoicesnew.ultranerds.co.uk/private:/home/ultranerds/web/invoicesnew.ultranerds.co.uk/public_shtml:/home/ultranerds/tmp:/tmp:/var/www/html:/bin:/usr/bin:/usr/local/bin:/usr/share:/opt) at /home/ultranerds/web/invoicesnew.ultranerds.co.uk/app/Utils/SystemHealth.php:134)

The weird part, is that its complaining about

/home/ultranerds/web/invoicesnew.ultranerds.co.uk/logs/invoicesnew.ultranerds.co.uk.log

Yet thats in the path of allowed directories:

/home/ultranerds/web/invoicesnew.ultranerds.co.uk/logs

Weird! (I’m also confused as to why its trying to write to that folder anyway?)

Ok I got it going - but had to comment out in SystemHealth.php:

    // foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
    //     if (strpos($file->getPathname(), '.git') !== false) {
    //         continue;
    //     }

    //     nlog($file->getPathname());

    //     if ($file->isFile() && ! $file->isWritable()) {
    //         return "{$file->getFileName()} is not writable";
    //     }
    // }

Not sure why - but that was what was stopping it.

Glad to hear it, thanks for the update!

cc @david

1 Like

Thanks for your persitance :slight_smile: I’m glad I went through with it - love the new interface!!!

1 Like