Error when upgrading to V5.5

Hello,

I use IN V5.4.12 in shared tenancy (softaculous). When i try to email an invoice i get an error 500 and after some research online it seems that the current version has a bug.
Since Softaculous hasn’t updated IN for a long time i decided to do a manual update. I changed the php from v7.4 to v8.1 and then i went to IN and run the update. Invoice Ninja V5.5.2 works on tablet and phone but when i try to access it from my PC using chrome browser i get an error 500.
Any ideas?

Hi,

Are there any details about the 500 error in storage/logs?

Thanks for your swift response.

Should I attempt to upgrade again and then share any logs? I have revert back to V5.4.12

If you’d like to try again we’re happy to help

What I did was:
enabled app_debug from env file.
changed php from 7.4 to 8.1
From IN bottom left, I upgraded to the latest version and i am getting the following error:

/home/xxxxx/invoice.xxxx.xx/app/Utils/SystemHealth.php:188

Call to undefined function App\Utils\exec()

  1. }
  2. ``
  3. private static function checkPhpCli()
  4. {
  5. try {
  6. exec('php -v', $foo, $exitCode);
  7. ``
  8. if ($exitCode === 0) {
  9. return empty($foo[0]) ? 'Found php cli, but no version information' : $foo[0];
  10. }
  11. } catch (Exception $e) {

I can access IN from the iphone app but not able to access it from any web browser.

If I set php to 8 or lower i get the following error: Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.1.0”.

Many thanks

You may want to try copying over the release zip

Am i downloading the file, extracting and copying ALL files in my cpanel file?

Yes, that is correct

The app broke when i copied over the content of the bootstrap folder. Now i get the following error and app is not accessible from the iOS apps.

XXXXx.XXXX.xx is currently unable to handle this request.

HTTP ERROR 500

I will revert to the latest backup.

Please check for details about the 500 in the web server error logs and the application log in storage/logs

Hello,

so, i tried again and i am still getting errors. The app is working only on iPhone -iPad app and not from web browser.

Log file error:
production.ERROR: Call to undefined function App\Utils\exec() {“userId”:1,“exception”:"[object] (Error(code: 0): Call to undefined function App\Utils\exec() at /home/xxxx/invoice.xxxxxxx/app/Utils/SystemHealth.php:155)
[stacktrace]

Web browser error:
/home/xxxxxx/invoice.xxxxxx/app/Utils/SystemHealth.php:188
183. }
184. 185. ` private static function checkPhpCli()` 186. ` {` 187. ` try {` 188. ` exec('php -v', $foo, $exitCode);` 189.
190. if ($exitCode === 0) {
191. return empty($foo[0]) ? 'Found php cli, but no version information' : $foo[0];
192. }
193. } catch (Exception $e) {

I believe that error is from the health check failing (cc @david).

Do you see any new errors when trying to login to the web app?

Yes the errors above.

i found a workaround here Invoice Ninja PHP 8.0 requires exec()? - #5 by LawOne

I changed from:
private static function checkPhpCli()
{
try {
exec(‘php -v’, $foo, $exitCode);

        if ($exitCode === 0) {
            return empty($foo[0]) ? 'Found php cli, but no version information' : $foo[0];
        }
    } catch (Exception $e) {
        return false;
    }
}

To
private static function checkPhpCli()
{
try {
if (function_exists(‘exec’)) {
exec(‘php -v’, $foo, $exitCode);
}

        if ($exitCode === 0) {
            return empty($foo[0]) ? 'Found php cli, but no version information' : $foo[0];
        }
    } catch (Exception $e) {
        return false;
    }
}

Should i keep these changes? App now is accessible

@david can you please advise?

I’ve checked something similar in for the next release.

thank you, so i will leave it as it is for now and if with the next release i have any issues i will amend it.

Any idea how i can get rid of the debug mode? I have changed the env file but it still notifies me that i am in debug mode. Please note i am on shared hosting.

@Gerasimos

In your browser, run https://YOURURL.COM/update?secret=secret

This will update the cache and it should remove that error message.