Unable to upgrade v4.5.42 from, PHP 7.3 to PHP 7.4 and Migrate to v5

I am trying to get this site updated to Invoice Ninja v4.5.50 so I can hopefully resolve the migration issues I have been having.

When I update to PHP 7.4 and try to view the Invoice Ninja site it just says “Whoops. Looks like something went wrong”

This is the last entry in the error log:

[2024-08-31 06:43:34] production.ERROR: ***ErrorException*** [0] : /home/billing1/public_html/app/Models/Account.php [Line 1126] => Unparenthesized `a ? b : c ?: d` is deprecated. Use either `(a ? b : c) ?: d` or `a ? b : (c ?: d)`  {"context":"PHP","user_id":1,"account_id":1,"user_name":"Michael Mason","method":"POST","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","locale":"en","ip":"138.199.30.167","count":1,"is_console":"no","is_api":"no","db_server":"mysql","url":"save_sidebar_state"} []
[2024-08-31 06:43:36] production.ERROR: ***ErrorException*** [0] : /home/billing1/public_html/app/Models/Account.php [Line 1126] => Unparenthesized `a ? b : c ?: d` is deprecated. Use either `(a ? b : c) ?: d` or `a ? b : (c ?: d)`  {"context":"PHP","user_id":1,"account_id":1,"user_name":"Michael Mason","method":"POST","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","locale":"en","ip":"138.199.30.167","count":2,"is_console":"no","is_api":"no","db_server":"mysql","url":"save_sidebar_state"} []
[2024-08-31 06:43:43] production.ERROR: ***ErrorException*** [0] : /home/billing1/public_html/app/Models/Account.php [Line 1126] => Unparenthesized `a ? b : c ?: d` is deprecated. Use either `(a ? b : c) ?: d` or `a ? b : (c ?: d)`  {"context":"PHP","user_id":1,"account_id":1,"user_name":"Michael Mason","method":"GET","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","locale":"en","ip":"138.199.30.167","count":3,"is_console":"no","is_api":"no","db_server":"mysql","url":"dashboard"} []

Here’s that line from that file:

$currencyId = ($client && $client->currency_id) ? $client->currency_id : $this->currency_id ?: DEFAULT_CURRENCY;

Can you perhaps help with this and then we can look at the migration?

Hi,

I believe I’m helping you in a separate thread.

As I explained there, this error implies the server is using PHP 8.

I know and I appreciate that but I feel there are 2 separate tasks here:

• Upgrade v4.5.42 → v4.5.50
• Migrate

And I think I cannot do the 2nd task until the first is completed.

I appreciate that the error implies a use of PHP 8.0 but it’s not. It’s using PHP 7.3 and this error happens when I upgrade to PHP 7.4

Would you like me to raise an issue on GitHub for this also?

This seems more likely related to the local configuration, issues are for bugs or feature requests.

OK… Here goes…

As per your message:

I created a new install of v4.5.50 on a new sub domain and copied over the .env file but cannot get the DB to accept the MySQL export from the v4.5.42 installation.

If I use MySQL Front (a remote application I use) it throws up the following error:

Cannot add foreign key constraint

If I try using PHPMyAdmin I get the following error:

Secure Connection Failed

So I tried a fresh install of v4.5.50 and overwrote the .env file and all I got was a blank page. No error log.

Are you using mysqldump to transfer the database?

Note: after you copy over the .env file you’ll need to update the database credentials

Hi

I was using MySQL Dump yes.

I updated the credentials in the file but if the database won’t import then I can’t use them.

I’ve tried updating the v4.5.42 by overwriting the files with v4.5.50 and running setup but ran into a PHP version error but when I updated the PHP to 7.4 just got a blank page and no error log.

I’m not sure mysqldump would fail

If you see a white screen there may be an error in the web server error logs

Now the sites have migrated to the new server I can focus on this so here’s what I am going to try and do as the v4.5.42 site just refuses to upgrade to v4.5.50 even on the new server.

• Fresh install of v4.5.50 on a staging domain
• Try and get the MySQL data from the v4.5.42 site and put it on the v4.5.50 site
• Then try and use the migration feature on the v4.5.50 site

Wish me luck.

And… FAILED. Bummer.

• Fresh install of v4.5.50 on a staging domain

I extracted the ZIP file
Overwrote the .env file
Made sure the site was on PHP 7.4
Changed the MySQL details and also the “APP_URL=” value

And nothing.

This is the error log from BEFORE I changed the MySQL credentials:

[2024-09-01T08:54:18.358908+00:00] production.ERROR: ***Illuminate\Database\QueryException*** [1045] : /home/billing3/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php [Line 669] => SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO) (SQL: select * from information_schema.tables where table_schema = forge and table_name = migrations and table_type = 'BASE TABLE')  {"context":"PHP","user_id":0,"account_id":0,"user_name":"","method":"GET","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","locale":"en","ip":"138.199.30.160","count":1,"is_console":"no","is_api":"no","db_server":"mysql","url":"install"} []

I also tried a completely clean installation with no .env file but when I got to the last step and clicked “Submit” all I got was a server 500 error.

I used a private browser and added a URL query string to force the server to deliver a new page:

https://DOMAIN.COM/public/?Page=02

And it redirects to:

https://DOMAIN.COM/public/setup

Can you help?

From the error it looks like you may need to update the database credentials in the .env file.

We did and I checked and still got an error so did a clean install.

I used a private browser and added a URL query string to force the server to deliver a new page:

https://DOMAIN.COM/public/?Page=02

And it redirects to:

https://DOMAIN.COM/public/setup

Can you help?

I suggest trying again, that error is very clear.

I’m not sure I understand, if it’s a clean install all routes redirect to /setup.

Yes. And I went through the setup process and the .enc file was created but yet when I try to access the site I get that error. Odd no?

I don’t understand, why are you going through setup process?

I’m trying to help but it feels like you ignore my suggestions.

I did follow what you said but it did not work so I decided to try a fresh install of v4.5.50.

I believe the error “Access denied for user ‘forge’@‘localhost’” likely points to the problem.

Agreed but as I mentioned above I edited the .env file and STILL got an error so decided to do a clean install.

Did you check the error logs again after seeing the error?