Koozali.org: home of the SME Server

PhreeBooks Accounting HowTo

Offline Charles2008

  • *
  • 174
  • +0/-0
PhreeBooks Accounting HowTo
« on: October 16, 2013, 02:10:23 PM »
I have been asked to write a HowTo for PhreeBooks Accounting.
Any feedback is welcome, particularly if it improves the security of my procedures.
Charles

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Disclaimer – this forum post is not advice or a recommendation it is informational only and describes the way I have set up PhreeBooks Accounting to work on my headless SME8 LAN test-server. Before you use PhreeBooks Accounting in a business environment you must satisfy yourself that it is suitable and meets you organisation's needs and the needs of your business jurisdiction you must also ensure that your unique set-up and file permissions meet your requirements and are appropriate for your hosting environment. You use anythng included in this post at your own risk.


PhreeBooks Accounting     (previously called PhreedomERP)                                          15th Oct.2013
PhreeBooks is a web based (multi-user), OpenSource, double-entry ERP/accounting software.
Demo:  http://www.phreebooks.com/pb-demo   ...  (demo, demouser)

Dave Premo is the project leader and has kept a very firm control of development.
In his own words - http://www.phreebooks.com/pb-forum/viewtopic.php?p=3178#p3178

Quote from: Dave Premo
“I am the primary developer …  some history:
I run a small battery company in the US [www.portablepower.com] and have a background as a design engineer. I was very unhappy with the commercial accounting applications out there as I found them to be difficult to adapt to my business and very expensive to operate in a multi-user environment. I wrote several interfaces to integrate my shipping, e-commerce sites, etc. to make my business flow smoothly.

Enter my search for an open source ERP solution. I first hooked up with webERP and wrote the reportwriter tool for the application. The project manager (in a similar position but earlier in the calendar to me) had a firm control over the architecture and I viewed a much different interface and structure. So I ended up looking for an architecture that I though brought about the flexibility I was looking for and ended up using the admin interface from ZenCart. (I have since completely re-written about 99.9% of the code and ended up building my own architecture) The other option was to branch off of webERP because of the stability of the accounting engine. So off I went in early 2007 to write my own accounting program. “

PhreeBooks aims to be a viable OpenSource alternative to Quickbooks and Peachtree/Sage.


Code Sources:
Sourceforge – latest release PhreeBooksR3.6RC2 (some of the excellent new features included in the recently updated and released v3.6 haven't yet IMHO been fully de-bugged. I would wait for RC3 before a full production implementation – I guess no more than a month or two away):
http://sourceforge.net/projects/phreebooks/files/latest/download?source=directory

GitHub – PhreeBooks-master (development only - not for use in a production environment):
https://github.com/phreebooks/PhreeBooksERP/archive/master.zip



Set-up on SME8:
(this is how I have done it. I have no doubt that this can be improved upon at almost every step)
Note -  hardened PHP (Suhosin) can be successfully used with PhreeBooks. You may have to tweek a few settings for long form posts (like phreeform forms for Sales/Invoices).


1. Create a Bookkeeping ibay (from which to run PhreeBooks):
URL - https://<server ip address>/server-manager
Information Bays > Add i-bay :
  • Information bay name - bookkeeping
  • Description – Phreebooks Accounting
  • Group – Admin    ...   (set user Group)
  • User access via file sharing or user ftp – Write = group, Read = group
  • Public access via web or anonymous ftp – Local network, no password required    ...   (production = p/w required IMHO)
  • Execution of dynamic content (CGI, PHP, SSI) – Enabled


2. Create a PhreeBooks database (either via command line or I use phpMyAdmin)
Please note that it is strongly advised to set MySQL to default to the InnoDB format and not
MyISAM, as apparently InnoDB is 'more robust'. PhpMyAdmin seems to be set out-of-the-box to default to MyISAM.

Quote from: Dave Premo
InnoDB supports 'transactions' which are CRITICAL for PhreBooks to operate properly. MyISAM do not and cause table sync problems in spades. If in doubt, post-install check your mysql tables and make sure the type is set to InnoDB - especially for the journal_main and journal_item tables.

phpMyAdmin - http://stackoverflow.com/questions/3939099/phpmyadmin-showing-myisam-instead-of-innodb
phpMyAdmin - http://virtualizesharepoint.com/2011/05/11/convert-myisam-to-innodb-using-phpmyadmin-for-moodle/
MySQL - http://wiki.contribs.org/MySQL

This InnoDB / MyISAM issue won't affect getting PhreeBooks going now, however, may cause some data integrity uncertainty down the road. Best to get it right now.

In phpMyAdmin:
  • Create database - phreebooks
  • Collation – utf8_general_ci
    Create user: select 'phreebooks' database from list on LHS > Privileges > Add User
    • set unique User Name and Password (make sure that you have made a note of these)
    • host - localhost
    • Database for user - Grant all privileges on database “phreebooks”
    • Add User



    3. Sort out OpenBaseDir restriction    (to allow files to be uploaded by PhreeBooks)
    Remotely get to command line of LAN SME8 server using ssh (secure shell):
    Open a terminal with root permissions (sudo su -  on my Linux PC)
    [/list]
    Code: [Select]
    ssh root@<server ip address> -L443:localhost:443 (Qn. Is this the best way/secure?)

    Here are the excellent instructions:    'Modifying the PHPBaseDir setting for an ibay'
    http://wiki.contribs.org/PHP#Open_basedir_restriction
       
    I can only add one tiny thing to these instructions; that if you get no response to No.1, then move straight on to the 3rd line of code in No.2. Like this:

    Code: [Select]
    db accounts setprop bookkeeping PHPBaseDir /home/e-smith/files/ibays/bookkeeping/:/tmp/
    then don't forget to:
    Code: [Select]
    signal-event ibay-modify bookkeeping
    Stay logged on to  …



    4. Create an upload directory in the Software ibay: (to receive your .zip file)
    cd to the <software ibay>/files and
    Code: [Select]
    mkdir phreebooks
    Stay logged on to  …



    5. Delete the index.html file: from the bookkeeping ibay
    Code: [Select]
    cd /home/e-smith/files/ibays/bookkeeping/html; dir  
    …  there it is. Now delete it:
    Code: [Select]
    rm index.html
    Code: [Select]
    exit


    6. Upload the PhreeBooks .zip file:
    I am sure that you could cd to the upload directory in 4. and wget the .zip file straight to the created upload directory. e.g.
    wget http://sourceforge.net/projects/phreebooks/files/latest/download?source=directory


    However, I use a Linux desktop and the following instructions are for this:
    Download .zip file from either of the two sources above. Secure copy .zip file to server:
    cd to Download directory on PC
    Code: [Select]
    scp <file to upload> root@hostname:<destination path e.g. /home/e-smith/files/ibays/<software ibay>/files/phreebooks>   
    (Qn. Is this the best way/secure?)
    …   replace <placeholders> with YOUR directory names.



    7. Unzip the PhreeBooks .zip file:
    ssh into LAN server as in 3. above.
    cd to upload directory, e.g.
    Code: [Select]
    cd /home/e-smith/files/ibays/<software ibay>/files/phreebooksunzip the uploaded file: (copy the file name exactly from server– right click, copy/paste)
    Code: [Select]
    unzip PhreeBooksR36RC2.zip   …   frenzy of unpacking

    See what's there:
    Code: [Select]
    dirthere should be 2 entries;
    PhreeBooksR36RC2   PhreeBooksR36RC2.zip   …   (one directory and the original  .zip file).
       
    Stay logged on to  ...



    8. Copy the PhreeBooks programme files over:  (to the bookkeeping ibay)
    cd into the  PhreeBooksR36RC2 directory, and copy the entire directory contents across using tar:
    Code: [Select]
    tar cf - . |(cd /home/e-smith/files/ibays/bookkeeping/html; tar xvf -)
    Stay logged on to  ...



    9. Set file 'ownership' and  'permissions' for installation:
    File ownership:    (give ownership of all files to the Apache web server)
    Code: [Select]
    chown -R www:www /home/e-smith/files/ibays/bookkeeping
    File permissions:     (who can see / do what)
    During PhreeBooks install /my_files and /includes need to have write permissions for the web server.

    Pre-install:
    ssh into LAN server and at the command line:
    Code: [Select]
    chmod -R 0750 /home/e-smith/files/ibays/bookkeeping
    Code: [Select]
    exit


    10. Install and configure PhreeBooks:
    Open a browser and type:
    https://<server ip address>/bookkeeping
    ... be patient, this can take a few seconds (depending on processor speed etc )
    follow the on-screen instructions.



    11. Post-install adjust file permissions, delete install directory:
    After install, the web server needs access to all directories for reading only, except /my_files which needs write access also for writing company specific files. Once you have the normal PhreeBooks desktop view (with dropdown menus across the top of the screen) then rename or delete the Install directory and make Includes/configure.php read only.

    Quote from: Dave Premo
    After install the only folder that needs write permission is the /my_files folder. That folder should be read/write from the web server (and FTP clients). All other folders should be only read accessible from the web server.

    Post-install:
    ssh into LAN server and at command line rename the install directory:
    Code: [Select]
    mv /<path to bookkeeping ibay>/html/install  /<path to bookkeeping ibay>/html/install.old    
    or delete it:
    Code: [Select]
    rm -rf install    
       

    Adjust file permissions:
    Code: [Select]
    chmod -R 0551 /home/e-smith/files/ibays/bookkeeping
    Code: [Select]
    chmod -R 0750 /home/e-smith/files/ibays/bookkeeping/html/my_files
    Code: [Select]
    chmod  0400 /home/e-smith/files/ibays/bookkeeping/html/includes/configure.php 
    edit-1 - I am investigating whether the 0551 file-permission above can be lowered to 0550 IF the user can pre-establish membership of a 'Group', i.e. by password protecting the ibay.

    edit-2 - sometimes, when I first log-in after having done the post-install file-permission modifications, I get a white screen. If I then just re-enter the required URL e.g. https://<server ip>/bookkeeping and then re-enter the log in information, I get straight onto the PhreeBooks landing page. This then doesn't happen again. So remember, if it happens to you at the first Login, just patiently retry and you will prevail :)

    edit-3 - I have needed to raise the file-permission level from 0750 to 0770 on /my_files above for the unusual and non-standard operation of importing a new XML report format.

    All other files (not directories):   ...   now, I haven't tried this yet. However, I think that this should work - if you think you need it.
    chmod  0441 /home/e-smith/files/ibays/bookkeeping/<path to file>
    edit - I need to investigate this (possibly 0440)



    12. There is a To-Do list on the PhreeBooks landing page.

    NOTE - I have read that on some hosting the Users and Groups are defined by the hosting company - IMHO this may well effect the file permissions required.
    « Last Edit: October 21, 2013, 04:55:44 PM by Charles2008 »

    Offline Charles2008

    • *
    • 174
    • +0/-0
    Re: PhreeBooks Accounting HowTo
    « Reply #1 on: October 17, 2013, 12:19:22 AM »
    I should note here that I had a problem getting the currencies to update on SMEserver due to it's security out-of-the-box.

    Here is the solution - a 'custom-template fragment' - sounds dreadful, but is actually painless.
    http://forums.contribs.org/index.php/topic,50263.15.html
    Charles



    edit - I am aware that this issue with currency updates (and the needed SME modification) doesn't seem to occur in other server distro's e.g. Ubuntu, Uniserver.
    « Last Edit: October 18, 2013, 09:38:55 AM by Charles2008 »

    Offline Jáder

    • *
    • 1,088
    • +0/-0
      • LinuxFacil
    Re: PhreeBooks Accounting HowTo
    « Reply #2 on: October 18, 2013, 11:40:17 AM »
    I'm creating the HOWTO in Wiki using the above info. Please let me format it for a couple of days... or join to formatting effort at wiki.contribs.org/PhreeBooks
    ...

    Offline Charles2008

    • *
    • 174
    • +0/-0
    Re: PhreeBooks Accounting HowTo
    « Reply #3 on: October 18, 2013, 12:03:52 PM »
    That's great.

    I was hoping to get some feedback on the bit's in red, before that. However, the 'suck it and see' approach is often a good one.
    Charles


    edit - I have just checked out the HOWTO wiki page and it looks excellent. I think that you are doing a very professional job of editing my post - you are a better judge than myself of what is relevant (as is so often the case with a third-party = impartial, fresh pair of eyes).

    Which 'difficulty' category are you going to put it into?   ...   Mensa?    :lol:
    « Last Edit: October 18, 2013, 01:16:11 PM by Charles2008 »

    Offline Jáder

    • *
    • 1,088
    • +0/-0
      • LinuxFacil
    Re: PhreeBooks Accounting HowTo
    « Reply #4 on: October 18, 2013, 02:21:44 PM »
    I have not thought about MENSA or DEBIL difficulty yet... that´s your call.
    I´m just a man writing the HowTo! :)
    ...

    Offline Charles2008

    • *
    • 174
    • +0/-0
    Re: PhreeBooks Accounting HowTo
    « Reply #5 on: October 18, 2013, 02:31:28 PM »
    Quote from: Jader
    I´m just a man ...

    ... you're the Editor!! In some publications the Editor = CEO  8-)

    I reckon that the 'Custom-template fragment' is the kicker to make it a Medium. Bottom quartile 'Medium' though  :)
    Charles

    guest22

    Re: PhreeBooks Accounting HowTo
    « Reply #6 on: October 18, 2013, 11:49:54 PM »
    Charles,

    thanks for putting in the effort. You've come a long way and did not ever give up. Much appreciated.

    Soon I will create a wiki page for FrontAccounting.

    guest

    Offline Charles2008

    • *
    • 174
    • +0/-0
    Re: PhreeBooks Accounting HowTo
    « Reply #7 on: October 19, 2013, 10:26:04 AM »
    Thanks HF. How do I PM you?  Charles

    guest22

    Re: PhreeBooks Accounting HowTo
    « Reply #8 on: October 19, 2013, 04:38:09 PM »
    Thanks HF. How do I PM you?  Charles

    You can't, messages has been disabled on these forums.

    guest22

    Re: PhreeBooks Accounting HowTo
    « Reply #9 on: October 19, 2013, 04:44:18 PM »

    Offline Jáder

    • *
    • 1,088
    • +0/-0
      • LinuxFacil
    Re: PhreeBooks Accounting HowTo
    « Reply #10 on: October 20, 2013, 11:36:03 AM »
    You're welcome.  All credits for Charles2008, I just formatted the wiki page!

    I'd like to ask someone else to test (follow step by step) the wiki steps.
    I'm sure they SHOULD work... but not sure if they REALLY works.

    ...

    guest22

    Re: PhreeBooks Accounting HowTo
    « Reply #11 on: October 20, 2013, 12:01:13 PM »