Error code: 500 Internal Server Error after update

Installed through Softaculous on Cpanel and has been working great for years. I just launched the updated from the previous version to the latest one and got a 500 internal server error.
The error log gives me this:

[19-Sep-2025 14:31:12 Asia/Singapore] PHP Fatal error:  Uncaught Dotenv\Exception\InvalidFileException: Failed to parse dotenv file. Encountered unexpected whitespace at ['4?????M'?']. in /home/dao2com/public_html/billing/vendor/vlucas/phpdotenv/src/Parser/Parser.php:30
Stack trace:
#0 /home/dao2com/public_html/billing/vendor/graham-campbell/result-type/src/Error.php(119): Dotenv\Parser\Parser::Dotenv\Parser\{closure}('Encountered une...')
#1 /home/dao2com/public_html/billing/vendor/vlucas/phpdotenv/src/Parser/Parser.php(31): GrahamCampbell\ResultType\Error->mapError(Object(Closure))
#2 /home/dao2com/public_html/billing/vendor/vlucas/phpdotenv/src/Dotenv.php(222): Dotenv\Parser\Parser->parse('# <?php exit('N...')
#3 /home/dao2com/public_html/billing/index.php(20): Dotenv\Dotenv->load()
#4 {main}
  thrown in /home/dao2com/public_html/billing/vendor/vlucas/phpdotenv/src/Parser/Parser.php on line 30

It’s running under PHP 8.1. I tried changing php to 8.3 same problem.
Any idea is welcome.

Version is 1.6.3

1 Like

Wanted to add that this is happening when finsihing the update process and going to /index.php/setup

Going to / also gives me 500 error though.

Hi @bfred, nice to hear you’ve been using InvoicePlane for years! From what version were you updating your version? For some updates we have different steps that have to be followed, you can see the upgrade guide here Update InvoicePlane - InvoicePlane Wiki

If you followed correctly the steps and are still getting the error, let me know and we will try to dig deeper in the issue.

1 Like

From 1.61 or 1.62. I regularly monitor Cpanel notifications and do the updates accordingly.

1 Like

Encountered unexpected whitespace at ['4?????M'?'].

There is something wrong inside the ipconfig.php file.
One of those lines contain an extra space that shouldn’t be there.

I’m thinking something like this:
DB_PASSWORD= MySuperSectetPassword!

See that space after DB_PASSWORD=?
That could be a reason.

Indeed there was a ‘red’ as in red color character when I edited the file. I changed the password both in the DB and the file and everything is back to normal.
Thank you very much.
Not sure what modified that string in the file but what is important is that it is back to work!

Thank you again,

1 Like