Help freeBSD install

gutiersa wrote on Monday, October 15, 2007:

I am trying to transition from my current emr to openemr. I am nearly done with the installation but am stuck. Here is what I have:

freebsd 6.2 - source distribution working pretty well
the following installed from ports
  apache-1.3.39_2 up and running
  php5-5.2.4_1
  php5-extensions-1.1
  mysql-server-4.1.22 up and running with openemr user created appropriately
openemr-2.8.3

I followed different sets of instructions for linux systems and adjusted them to mine.
I even was able to run setup succesfully, but when attempting to start using openemr (ie: http://localhost/openemr), I get the following error:

ERROR: query failed: SELECT * FROM lang_definitions JOIN lang_constants ON lang_definitions.cons_id = lang_constants.cons_id WHERE lang_id=‘1’ AND constant_name = ‘Login’ LIMIT 1 (No database selected)

Please help! I am really looking forward to integrating openemr into my practice.
     

openemrhq wrote on Monday, October 15, 2007:

Have you changed any database names during the installation or could your hosting setup (even if it’s a local PC in your office) be changing the database name from the default ‘openemr’ to something else?  What happens if you issue the query manually by going to something like MySQLAdmin? Do you still get the same error?

Thanks,
Dave Kennerson
OpenEMR HQ, Inc

gutiersa wrote on Monday, October 15, 2007:

thanks for your reply.

my set up is a stand alone computer.

I have just installed openemr and have not yet accessed the login page ever.

sqlconf.php still shows ‘openemr’ as the name of the database.

I entered the following at the mysql promt, after choosing oepenemr as database:

  SELECT * FROM lang_definitions JOIN lang_constants ON lang_definitions.cons_id = lang_constants.cons_id WHERE lang_id=‘1’ AND constant_name = ‘Login’ LIMIT 1

and I get:

  Empty set (0.12 sec)

Incidentally, when I view the contents of lang_definitions, I noticed it’s all in spanish. I am going to need them in English. What happened?

thanks thanks again!

gutiersa wrote on Monday, October 15, 2007:

On second thought, the query asks for lang_id=‘1’ but my lang_definitions table has only lang_id of 3, since as I mention before, the table is in spanish. the other tables: lang_constants and lang_languages are in english.  ???

thanks! 

andres_paglayan wrote on Monday, October 15, 2007:

if it’s set to 1, means English, and no DB querrying is done,

drbowen wrote on Tuesday, October 16, 2007:

The default language is in English.  So not to worry. 

I run FreeBSD (currently on 6.1) on the public demo (but am upgrading to 6.2.)

Does your language table exist?

Do the contents of openemr/library/sqlconf.php

look something like this:

#######################
<?
//  OpenEMR
//  MySQL Config
//  Referenced from sql.inc

$host   = ‘localhost’;
$port   = ‘3306’;
$login  = ‘openemr’;
$pass   = ‘yourpasswordhere’;
$dbase  = ‘openemr’;

$sqlconf = array();
$sqlconf["host"]= $host;
$sqlconf["port"] = $port;
$sqlconf["login"] = $login;
$sqlconf["pass"] = $pass;
$sqlconf["dbase"] = $dbase;
//////////////////////////
//////////////////////////
//////////////////////////
//////DO NOT TOUCH THIS///
$config = 1; /////////////
//////////////////////////
//////////////////////////
//////////////////////////
?>
##########################

The important lines are 6-10.  These should contain your variables as selected in the setup routine.  Don’t post these here (especially your password).

$host   = ‘localhost’;
$port   = ‘3306’;
$login  = ‘openemr’;
$pass   = ‘yourpasswordhere’;
$dbase  = ‘openemr’;

Can you log into the mysql command prompt using user openemr and the password for openemr?

Sam Bowen, MD

gutiersa wrote on Tuesday, October 16, 2007:

Thanks for your reply.

Here is where I am…

The problem turned out to be a localhost issue that my system has. For some reason my ip address is not equal to localhost most of the time. So Mr. Kennerson above was right, for some reason after setup.php (where I specified my ip address) the host went back to local host. So the program did not find the database openemr at localhost, which makes sense.

To answer your questions:

I have these tables lang_constants lang_definitions and lang_languages, and lang_definitions looks like this:
±-------±--------±--------±-----------------------------------------------------------------------------------------+
| def_id | cons_id | lang_id | definition                                                                               |
±-------±--------±--------±-----------------------------------------------------------------------------------------+
|      1 |       6 |       3 | Grupo                                                                                    |
|      2 |       8 |       3 | Usuario:                                                                                 |
|      5 |      10 |       3 | EOB Posting - Instrucciones                                                              |
|      6 |      11 |       3 | Codigo Postal                                                                            |
|      7 |      12 |       3 | Apellido                                                                                 |
|      8 |      18 |       3 | Hasta:                                                                                   |
|      9 |      17 |       3 | Edades desde:                                                                            |
|     10 |      15 |       3 | Fecha de Cita                                                                            |
|     11 |      16 |       3 | Herramienta de Comunicaciones                                                            |
|     12 |      14 |       3 | Femenino                                                                                 |
|     13 |      13 |       3 | Masculino                                                                                |
|     14 |      19 |       3 | Seguro Social                                                                            |
|     15 |      20 |       3 | Administracion de Usuarios y Grupos                                                      |
|     16 |      21 |       3 | Salir                                                                                    |
|     17 |      22 |       3 | Contraseña:                                                                             |
|     18 |      23 |       3 | Entrar                                                                                   |
|     19 |      24 |       3 | Administración                                                                          |
|     20 |      25 |       3 | Contraseña                                                                              |
|     21 |      28 |       3 | Facturación                                                                             |
|     22 |      29 |       3 | Inicio                                                                                   |
|     23 |      27 |       3 | Notas                                                                                    |
|     24 |      26 |       3 | Informes                                                                                 |
|     25 |      32 |       3 | (Más)                                                                                   |
|     26 |      31 |       3 | Autorizaciónes                                                                          |
|     27 |      33 |       3 | Localizar Paciente                                                                       |

I changed the 3 to a 1 for lang_id, because I was eager to see the program working in my system.

My sqlconf.php file looks like this after I changed $host from localhost.

//  OpenEMR
//  MySQL Config
//  Referenced from sql.inc

$host    = ‘192.168.x.xx’;
$port    = ‘3306’;
$login    = ‘openemr’;
$pass    = ‘mypasswordhere’;
$dbase    = ‘openemr’;

$sqlconf = array();
$sqlconf["host"]= $host;
$sqlconf["port"] = $port;
$sqlconf["login"] = $login;
$sqlconf["pass"] = $pass;
$sqlconf["dbase"] = $dbase;
//////////////////////////
//////////////////////////
//////////////////////////
//////DO NOT TOUCH THIS///
$config = 1; /////////////
//////////////////////////
//////////////////////////
//////////////////////////

The program seems to be working, at least I was able to log in as admin.

Here is what happens when I try to log in to mysql as openemr:

Hserv# /usr/local/bin/mysql -u openemr -p openemr
Enter password:
ERROR 1044 (42000): Access denied for user ‘openemr’@‘localhost’ to database ‘openemr’

again it is the same problem of the localhost. Setup.php did not create the user with host 192.168.x.xx as I requested. Or if it did it got changed.

*************************************************************************************************************************************

By the way, the lang_definitions table has another problem, I think. Not just that it’s in spanish, but my login screen has the following:

Notas (notes) where the word User should be, and Facturacion (billing) where the word password should be.
at the bottom of the page there is the word inicio which is correct for start. The rest of the page is correctly in English.

Thank you so much for your help!

drbowen wrote on Tuesday, October 16, 2007:

I have not had this problem with any of the FreeBSD installations that I have done.  Perhaps it is the way you are setting up the FreeBSD?  The default mysql.sh startup script usually defines "skip-networking".  It may not recognize openemr@192.168.x.xx while openemr@127.0.0.1 or openemr@localhost may work fine.

You can of course define passwords for openemr@192.168.x.xx, openemr@127.0.0.1, and openemr@localhost by using:

GRANT ALL on openemr.* to openemr@192.168.x.xx IDENTIFIED BY ‘mypasswordhere’;
GRANT ALL on openemr.* to openemr@127.0.0.1 IDENTIFIED BY ‘mypasswordhere’;
GRANT ALL on openemr.* to openemr@localhost IDENTIFIED BY ‘mypasswordhere’;

Having hacked OpenEMR a number of different ways, permission problems are always easier if you use the set-up script though it is not the only way.  I have never had this difficulty with FreeBSD and I wonder about the way you have set up your FreeBSD configuration.

What does your /etc/hosts file look like?

What happens when you ping

192.168.x.xx
localhost
127.0.0.1

Are you running a firewall on your server?  Did you allow unrestricted traffic on the loopback interface (lo)?

Sam Bowen, MD

gutiersa wrote on Wednesday, October 17, 2007:

I did create several openemr users with the different possible hosts.

I agree that my problem is specific to my set up. Something is configured incorrectly. For example:

http://localhost:631 (for cups) works great, but not http://192.168.x.xx:631 whereas
http://localhost:901 doesn’t work for the swat file (for samba), whereas http://192.168.x.xx:901 works quickly;
finally, as you know php files open up with my ip address, and not localhost.

Here is my host file:

::1            localhost     localhost.mydomain     freebsdserv.mydomain
127.0.0.1        localhost     localhost.mydomain     freebsdserv.mydomain
192.168.x.xx        freebsdserv.mydomain     freebsdserv
192.168.x.xx        localhost     localhost.mydomain     freebsdserv.mydomain

these are the results of ping:

server# ping -c 4 localhost
PING localhost (127.0.0.1): 56 data bytes
ping: sendto: Can’t assign requested address
ping: sendto: Can’t assign requested address
ping: sendto: Can’t assign requested address
ping: sendto: Can’t assign requested address

Hserv# ping -c 4 192.168.x.xx
PING 192.168.x.xx (192.168.x.xx): 56 data bytes
64 bytes from 192.168.x.xx: icmp_seq=0 ttl=64 time=0.037 ms
64 bytes from 192.168.x.xx: icmp_seq=1 ttl=64 time=0.028 ms
64 bytes from 192.168.x.xx: icmp_seq=2 ttl=64 time=0.028 ms
64 bytes from 192.168.x.xx: icmp_seq=3 ttl=64 time=0.031 ms

Hserv# ping -c 4 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
ping: sendto: Can’t assign requested address
ping: sendto: Can’t assign requested address
ping: sendto: Can’t assign requested address
ping: sendto: Can’t assign requested address

No firewall in my server yet, and I don’t really know how to configure the loopback interface. I haven’t been able to figure that out. This problem started after a installed one of the many programs I have, but I don’t know which one.

Thanks.

gutiersa wrote on Wednesday, October 17, 2007:

Finally, after months, the answer was in one of the freebsd forums.

my network_interfaces line in /etc/rc.conf was incorrect. It read:

network_interfaces=vr0

the correct is:

network_interfaces="vr0 lo0"

now localhost works well.

thanks