500 Server Errors after Update to 1.6.0

I am running into issues after upgrading to PHP 8.1 and trying to load up v1.6.0.

I am getting 500 server errors after following the first three steps of the following guide:

https://wiki.invoiceplane.com/en/1.6/getting-started/updating-ip

Any assistance on this would be much appreciated. Below is the following apache error log:

[Mon Dec 05 07:59:03.607817 2022] [php:error] [pid 33662] [client ipv6address:55984] PHP Fatal error: Uncaught Dotenv\Exception\InvalidFileException: Failed to parse dotenv file. Encountered an invalid name at [<?php exit('No direct script access allowed'); ?>]. in /var/www/mywebsite.com/invoiceplane/vendor/vlucas/phpdotenv/src/Parser/Parser.php:30\nStack trace:\n#0 /var/www/mywebsite.com/invoiceplane/vendor/graham-campbell/result-type/src/Error.php(118): Dotenv\Parser\Parser::Dotenv\Parser\{closure}()\n#1 /var/www/mywebsite.com/invoiceplane/vendor/vlucas/phpdotenv/src/Parser/Parser.php(31): GrahamCampbell\ResultType\Error->mapError()\n#2 /var/www/mywebsite.com/invoiceplane/vendor/vlucas/phpdotenv/src/Dotenv.php(222): Dotenv\Parser\Parser->parse()\n#3 /var/www/mywebsite.com/invoiceplane/index.php(16): Dotenv\Dotenv->load()\n#4 {main}\n thrown in /var/www/mywebsite.com/invoiceplane/vendor/vlucas/phpdotenv/src/Parser/Parser.php on line 30

Ok, I figured it out. I had to enable setup in my env file and it fixed up the DB just fine.

3 Likes

Great job, man! Would you mind if we keep this topic open? A lot of users are going to run into this issue

Also: please do not forget to rename your ipconfig.php file to something only you know
orrrrr protect it through your nginx config orrrr move it outside the document_root

1 Like

Hi, How? I’m getting the same errors

1 Like

open ipconfig.php and remove the top line, then report back if you’re not getting the errors anymore

1 Like

Hi, it worked, but I’m getting cannot_connect_database_server and I have the correct info to DB

1 Like

Is it while running the setup? Or did you already install the application?

in the setup process after language setup

1 Like

Is it in production? Or on a test environment?
Turn on debug modus and tey to figure out the real error message that the database is giving

I have done that, but I can’t see any real error

1 Like

Can you confirm that the DB_ config values are still in the config file?

yes they are

Ok, so due to the upgrade in the packages that are included in 1.6, the config file needs to be moved. Can you move it to some subfolder like application or something and then go into the index.php file and modify the following lines:

Line 14:
if (!file_exists('[PUT YOUR NEW IPCONFIG PATH HERE]/ipconfig.php')) {

Line 19:
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__, '[PUT YOUR NEW IPCONFIG PATH HERE]/ipconfig.php');

Line 303:
define('IPCONFIG_FILE', FCPATH . '[PUT YOUR NEW IPCONFIG PATH HERE]/ipconfig.php');

Then move the config file to this location. Let’s do this first and see if that fixes the issue. If not, let me know.

1 Like

first, thank you so much. but I still have the same error about the DB connection error.
can I bypass did page ?

thank you again

Hi,

I am also getting the same error.

Is this a bug ?

Hi @jameswill could you kindly specify which error are you seeing?

Hi @Noha_Sorani can you kindly let us know what db software are you using (MySQL, MariaDB,…) andwhat version it is?

Further, what PHP version are you running?

1 Like

I have Mariadb and PHP v.8.1

1 Like

Hi,

On visiting the installation page it gives the following error.

Fatal error: Uncaught Dotenv\Exception\InvalidFileException: Failed to parse dotenv file. Encountered an invalid name at []. in [[PATH]]/vendor/vlucas/phpdotenv/src/Parser/Parser.php:30 Stack trace: #0 [[PATH]]/vendor/graham-campbell/result-type/src/Error.php(118): Dotenv\Parser\Parser::Dotenv\Parser{closure}(‘Encountered an …’) #1 [[PATH]]/vendor/vlucas/phpdotenv/src/Parser/Parser.php(31): GrahamCampbell\ResultType\Error->mapError(Object(Closure)) #2 [[PATH]]/vendor/vlucas/phpdotenv/src/Dotenv.php(222): Dotenv\Parser\Parser->parse('load() #4 {main} thrown in [[PATH]]/vendor/vlucas/phpdotenv/src/Parser/Parser.php on line 30

On deleting first line from ipconfig.php starts the installation However on filling the database details installer gives another error.

Failure
Cannot connect to the database server with the provided database information. Please check the credentials and try again.

I am using php 8.1 and mysql 5.7

1 Like