Topic: Errors in new install of FrontAccounting - wrong Webroot Path

A new installation on Ubuntu.  (FrontAccounting Version 2.3.24 Build 26.10.2015)

Eventually managed to get everything setup, and can login.  However, having an issue.
After clicking on any link, I'm returned to the login screen.  If I login, then I get to that previously clicked page, but I have to login after every click.

On the page(s), I get 4 lines of  errors:

session_start(): open(/opt/FrontAccounting/includes/opt/FrontAccounting/tmp//sess_hpsp7onb2fq9l0a05p85ts8in5, O_RDWR) failed: No such file or directory (2) in file: /opt/FrontAccounting/includes/session.inc at line 29
session_write_close(): open(/opt/FrontAccounting/includes/opt/FrontAccounting/tmp//sess_k7f4dqh3h1k89mnh9r8i189cj2, O_RDWR) failed: No such file or directory (2) in file: /opt/FrontAccounting/includes/session.inc at line 86
session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/opt/FrontAccounting/includes/opt/FrontAccounting/tmp/) in file: /opt/FrontAccounting/includes/session.inc at line 86
session_start(): open(/opt/FrontAccounting/includes/opt/FrontAccounting/tmp//sess_k7f4dqh3h1k89mnh9r8i189cj2, O_RDWR) failed: No such file or directory (2) in file: /opt/FrontAccounting/includes/session.inc at line 90

The application is installed at /opt/FrontAccounting, which is the webroot for the V-host.  Apparently, the script is picking up the directory as a relative path as opposed to an absolute, and thus, is duplicating it, as in "/opt/FrontAccounting/includes/opt/FrontAccounting/tmp//". Note that there is also a double slash at the end of the path.

I have checked the permissions and they seem to be OK.

Any pointers?

Re: Errors in new install of FrontAccounting - wrong Webroot Path

Remove the .htaccess file and check - then tweak it.

Re: Errors in new install of FrontAccounting - wrong Webroot Path

Don't have a .htacess file in place.  And I do have full access to the server.

4 (edited by apmuthu 10/29/2015 03:34:57 pm)

Re: Errors in new install of FrontAccounting - wrong Webroot Path

The tmp folder in the FrontAccounting webroot needs to be writeable by the webserver process www-data - that is where the sessions get stored in your install. These settings are in the includes/session.inc file in line 387 commented out as it is expected to be set in the php.ini file's session.save_path setting.

Re: Errors in new install of FrontAccounting - wrong Webroot Path

I have figured out the issue, but not a valid solution.

I set the session.save_path setting as directed in the  includes/session.inc file.  However, I am seeing various errors, which suggests that there is a problem with parsing the path as set in the file.

1.  If I use ini_set('session.save_path', dirname(__FILE__).'/tmp/'); - that is setting the path to /tmp, then I get the following errors:

Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/opt/FrontAccounting/includes/tmp/)

2. if If I use ini_set('session.save_path', dirname(__FILE__).'./tmp/'); - that is setting the relative tmp path to /opt/FrontAccounting/tmp, then I get the following errors:

Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/opt/FrontAccounting/includes./tmp/)

3. if If I use ini_set('session.save_path', dirname(__FILE__).'/opt/FrontAccounting/tmp/'); - that is explicitly setting the path to /opt/FrontAccounting/tmp, then I get the following errors:

 Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/opt/FrontAccounting/includes/opt/FrontAccounting/tmp/)

It looks like the path is being read as relative to ./includes and not from the Dir_Root (/opt/FrontAccounting)
If I make a symlink in ./included pointing to /opt, thereby making the paths valid, then everything seems to work (so far).  However, i don't know what else would end up breaking with this workaround, so I would prefer not to have to use it.

Re: Errors in new install of FrontAccounting - wrong Webroot Path

Of course it's relative to the "includes" directory, because that's where session.inc resides. The function dirname(__FILE__) returns the path to the running script.

You can either use an absolute path:
ini_set('session.save_path', '/opt/FrontAccounting/tmp/');

or append the relative path to the current directory:
ini_set('session.save_path', dirname(__FILE__).'/../tmp/');

I recommend the latter, as it does not make any assumption about where FA is actually installed.

Re: Errors in new install of FrontAccounting - wrong Webroot Path

here, the file and directory permission is the problem. you should check the permissions before you try other options.

may be the parent or folder, which doesnot have the access to work on.

Subscription service based on FA
HRM CRM POS batch Themes

8 (edited by apmuthu 10/31/2015 06:13:46 am)

Re: Errors in new install of FrontAccounting - wrong Webroot Path

... Or create the folder it wants / expects ..... smile

9 (edited by albertolima 06/01/2016 04:43:30 pm)

Re: Errors in new install of FrontAccounting - wrong Webroot Path

I posted earlier and deleted thinking I was off topic. I am posting again, see if it helps.

Before the installation wizard
After decompressing the files to the frontaccounting installation folder, run the following commands:
(change /var/www/html/frontaccounting to your FrontAccounting installation path)

sudo chown -R www-data:www-data /var/www/html/frontaccounting

Then run the installation wizard and get yourself setup

After the installation wizard, run the following, to revoke user www-data write access to the config files

sudo chown root:root /var/www/html/frontaccounting/config.php
sudo chown root:root /var/www/html/frontaccounting/config_db.php

Typical config.php modifications after installation:
-timezone
-show users online
-login max 3 times (brute force prevention)

Check security on the diagnostics link in FrontAccounting to confirm it is good to go.

10 (edited by George 11/01/2015 12:26:26 am)

Re: Errors in new install of FrontAccounting - wrong Webroot Path

Thanks for the responses, I have now resolved the problem.  As was suggested by TM, I adjusted the file path, as all of my permissions were correct.


While I had figured out what the problem was, not being able to read "PHP" prevented me from seeing the solution staring me right in the face.

The issue was that I did not understand that the syntax dirname(__FILE__). represented the relative path for the running script.  As TM mentioned,

TM wrote:

The function dirname(__FILE__) returns the path to the running script.

  This was why my entries were all being evaluated relative to the includes directory, even when I thought I was entering an absolute path.

I have now set it to be

ini_set('session.save_path', dirname(__FILE__).'/../tmp/');

which will give me the expected WEBROOT/tmp location, and is also "portable" if I were to move my installation to another folder/directory.

Thanks again to all who responded with suggestions.


Hope the explanation helps anyone else who may stumble on this issue as I did.  Now, on to evaluate FA on its merits.

Re: Errors in new install of FrontAccounting - wrong Webroot Path

@joe: Would you like to correct the commented out line in session.inc (Post 4 in this thread) to match tm/George's construct?