Steps to setup LibreEHR on local machine

Hi , i have cloned the LibreEHR repo from GITHUB and want to set it up and start going around the code base in order to be able to contribute. But when i navigate to the app from the browser i get an empty page. I would like some directions/Steps on how to setup the project on my localhost in order to start development.

Hello Gaston! I had no idea that Facebook had anything to do with GitHub myself. So, did you start at http://localhost/libreehr? You can try localhost/libreehr/setup.php You must also ensure that mysql or mariaDB (whichever database you have running) is up and going. Forgive me if these are silly questions, but you have not given any specifics of how you set up Apache and the database, or what your operating system of the localhost is. Verify that apache and mysql are running, and let’s go through this step-by-step. -Art

sorry, that was an error. But i just fixed the problem now. It was an issue of permissions on my local server.

1 Like

Good for you man! (good old CHMOD777)


Now i am getting an error with setup of the EHR, this is the error ERROR when granting privileges to the specified user. unable to execute SQL: ‘GRANT ALL PRIVILEGES ON libreehr.* TO ‘libreehr’@‘localhost’ IDENTIFIED BY ‘secret’’ due to: Access denied for user ‘root’@’%’ to database ‘libreehr’

What is the OS and server software versions?

kali linux os and apache server

How about the database and PHP version?

database is mysql Ver 15.1 Distrib 10.1.21-MariaDB, for debian-linux-gnu (i686) using readline 5.2 while the php version is PHP 7.0.15-1

Can you verify that you can use (do anything) as root with the root password?

I have been able to use the root account to delete the database librehr from command line in order to be able to refresh the installation stage.

OK, sounds like we need the help of a real unix sysadmin here because: I am a linux noob, You are running a “greyhat” version of linux that might pride itself on locking everything down to the point of asphyxiation, I would rather you get CL commands that actually work on Linux, as the mysql CL stuff is different for some darn reason on windows (my problem, not yours). Perhaps if no-one else chimes in, we should move this onto the chat server in the GSOC channel to get some assistance from the real geeks.

1 Like

This definitely sounds like a better “real time” troubleshooting effort for :slight_smile:

I think this can be solved as follows on ubuntu machine (16.04):-

  • Set up the lampp stack as follows: a) Install Apache 2 (sudo apt-get install apache2) b) Install MySql Server (sudo apt-get install mysql-server) c) Install PHP 7.0 and additional packages. (sudo apt-get install php7.0 php-pear libapache2-mod-php7.0 php7.0-mysql)

  • Install additional dependencies as mentioned by @teryhill : libapache2-mod-php libdate-calc-perl libdbd-mysql-perl libdbi-perl libhtml-parser-perl libtiff-tools libwww-mechanize-perl libxml-parser-perl php7.0-cli php7.0-gd php7.0-xsl php7.0-curl php7.0-mcrypt php7.0-soap php7.0-json php7.0-gettext imagemagick php7.0-mbstring php7.0-zip php7.0-ldap

  • Turn off the strict mode in mysql. It can be done as follows: create disable_strict_mode.cnf in /etc/mysql/conf.d/ remember you have root privilege while doing this. Then paste this code [mysqld] sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    then restart mysql server.

  • Then make the necessary changes in php.ini and apache2.conf file as mentioned in setup.php.

Hope this works well :slight_smile:

The simplest explanation for that error message would be that the wrong password was typed in to the root password box during installation.
Does your MariaDB server have a password associated with the root account? When you deleted the database did it require that password?

All of the configuration steps Priyanshu described are needed to get things running eventually, but not having all the prerequisites and still having strict mode enabled isn’t likely to cause a problem at the point where you are reporting the error.