Administration (Backup feature)

dlee5400 wrote on Wednesday, November 25, 2009:

Windows 2003
IIS 6
PHP Version 5.2.11
MySQL  5.1.40
OpenEMR 3.1.0 - Patch 4

I am testing the backup feature and i get the following message:
   
    Dumping OpenEMR database…                                                                                                                                                                                                                                                “C:/xampp/mysql/bin\mysqldump -u “openemr001” -p"dlee5400” -opt -quote-names -r C:\WINDOWS\TEMP/openemr_web_backup/emr_backup/openemr.sql “openemr001"” returned -1:

Any insight?

Thanks!

bradymiller wrote on Wednesday, November 25, 2009:

hey,

In the openemr/interface/main/backup.php file at line 58, set the $GLOBALS variable to the path where your mysql binary is. (don’t worry about the perl or temp directory variables).

-brady

dlee5400 wrote on Friday, November 27, 2009:

Just a note Brady,

I noticed that when PHP 5.2.1 or greater is used  the code overrides the “temporary_files_dir_win” variable with “sys_get_temp_dir()”. When  this happens (in windows) the “sys_get_temp_dir()” returns the trailing backslash. I’m not sure if that matters or not overall but as you  can see it is ugly and might raise future questions.

I made the requested changes and i’m still get the following:

    “C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump -u “openemr001” -p"dlee5400” -opt -quote-names -r C:\WINDOWS\TEMP\openemr_web_backup/emr_backup/openemr.sql “openemr001"” returned -1:

What directory rights and for whom does that “windows/temp” directory need to have?

Thanks!

bradymiller wrote on Friday, November 27, 2009:

hi,

In XAMPP (uses php>5.2.1) this works fine, so the “double” slash is not really an issue (agree not pretty). Since your using IIS web server, and since permissions have always seemed to be the issue, I’d just make that directory to be as open as possible to get it to work (then can begin to limit the permissions).

-brady

bradymiller wrote on Friday, November 27, 2009:

hey,

There also seems to be some ugliness in your command (ie -p and the password are not space). Have you modified anything else besides the variables at the top of the backup.php file?

-brady

bradymiller wrote on Friday, November 27, 2009:

hey,
Could be the spacing in the command path.

Try this:
At line 196 in openemr/main/backup.php, substitute:
<pre><code>$cmd = “$mysql_dump_cmd -u " . escapeshellarg($sqlconf) .</code></pre>
with:
<pre><code>$cmd = “”$mysql_dump_cmd” -u " . escapeshellarg($sqlconf) .</code></pre>

let me know how this works. If it does then we’ll fix this bug in cvs and get it in the next patch.

-brady

dlee5400 wrote on Saturday, November 28, 2009:

The change didn’t do it; although i did cut and paste the command to the command line and it wouldn’t work until i put  double quotes around the sub directories that have spaces in them ie:

    C:“Program Files”\MySQL"MySQL Server 5.1"\bin\mysqldump -u “openemr001” -p “dlee5400” -opt -quote-names -r C:\WINDOWS\TEMP\openemr_web_backup/emr_backup/openemr.sql “openemr001”

This asked for a password so i suspect it was moving pass the issue. I tried to get it to take those double quotes literally in PHP but no success. Any thoughts with this tid bit of info?

Thanks!

bradymiller wrote on Saturday, November 28, 2009:

hey,

At commandline try:
<pre><code>“C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump” -u “openemr001” -p"dlee5400" -opt -quote-names -r C:\WINDOWS\TEMP\openemr_web_backup/emr_backup/openemr.sql “openemr001”</code></pre>

Note I am putting entire command in quotations and I am leaving no space between -p and the password (this is on purpose). If this indeed works then I’d re-start from the original backup.php and put in your paths at top and only make the one line change that is described above at line 196.

-brady

bradymiller wrote on Saturday, November 28, 2009:

hey,
improved line (some issues with the _ character above) and removed the -r stuff for now:
<pre><code>“C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump” -u “openemr001” -p"dlee5400" -opt -quote-names “openemr001”</code></pre>

-brady

dlee5400 wrote on Saturday, November 28, 2009:

That last entry ran perfectly … hmmm

bradymiller wrote on Saturday, November 28, 2009:

hey,

1) Start with a fresh interface/main/backup.php file:

2) Then replace line 58 with(don’t touch the slashes):
<pre><code>$GLOBALS = “C:/Program Files/MySQL/MySQL Server 5.1/bin”;
</code></pre>

3) Remove browser cookies and login to openemr, and  try backup script.

4) If backup script doesn’t work then copy/paste output here in forum, and then replace line 196 with:
<pre><code>$cmd = “”$mysqldumpcmd" -u " . escapeshellarg($sqlconf) .</code></pre>

5) Again, remove browser cookies, re-login to openemr and try the backup.

6) If doesn’t work, then again paste output here in forum.

-brady

  : http://openemr.cvs.sourceforge.net/viewvc/*checkout*/openemr/openemr/interface/main/backup.php?revision=1.5.2.1

tmccormi wrote on Saturday, November 28, 2009:

Brady -  Thanks for the support on this.  Bill has been out of town or he would have been hot on this issue.

Tony

dlee5400 wrote on Saturday, November 28, 2009:

Here is the results from line 58 being:

    $GLOBALS = “C:/Program Files/MySQL/MySQL Server 5.1/bin”;

the results are :

    Dumping OpenEMR database…                                                    `"\mysqldump -u “openemr001” -p"dlee5400" -opt -quote-names -r C:\WINDOWS\TEMP/openemr_web_backup/emr_backup/openemr.sql “openemr001"” returned -1:

dlee5400 wrote on Saturday, November 28, 2009:

here is the result from 196:

    Dumping OpenEMR database…

 
    “”" -u “openemr001” -p"dlee5400" -opt -quote-names -r C:\WINDOWS\TEMP/openemr_web_backup/emr_backup/openemr.sql “openemr001"” returned -1:

bradymiller wrote on Sunday, November 29, 2009:

crap,

I sabotaged you on both inserts (note the missing \_ character in mysqlbindir\_win, which should be mysq\l_bin\_dir\_win). friggin forum formatting is killing me here. Here are fixed instructions:

1) Start with a fresh interface/main/backup.php file:

2) Then replace line 58 with(don’t touch the slashes):

<pre><code>$GLOBALS = “C:/Program Files/MySQL/MySQL Server 5.1/bin”;</code></pre>

3) Remove browser cookies and login to openemr, and try backup script.

4) If backup script doesn’t work then copy/paste output here in forum, and then replace line 196 with:

<pre><code>$cmd = “”$mysql_dump_cmd" -u " . escapeshellarg($sqlconf) .</code></pre>

5) Again, remove browser cookies, re-login to openemr and try the backup.

6) If doesn’t work, then again paste output here in forum.

sorry,
-brady

  : http://openemr.cvs.sourceforge.net/viewvc/*checkout*/openemr/openemr/interface/main/backup.php?revision=1.5.2.1

wmartinez wrote on Sunday, November 29, 2009:

Hello,  I think I can help you with your project. I have been very interested in the medical software arena for some time but have been unable to land a job in the medical software field. I’ve seen a lot of stuff on line about Open Source projects but not having been involved in any I’m not sure about the proper way to get involved.  I am an experienced .net with some knowledge of php. I think I could be of help, if you don’t mind spending some time to help me get cranked up. Let me know if i can help?

tmccormi wrote on Sunday, November 29, 2009:

wmartinez - Please do not post unrelated commentary in a technical discussion.
-Tony

dlee5400 wrote on Sunday, November 29, 2009:

Line 58 replacment outcome:

Dumping OpenEMR database…

 
“C:/Program Files/MySQL/MySQL Server 5.1/bin\mysqldump -u “openemr” -p"dlee5400” -opt -quote-names -r C:\WINDOWS\TEMP/openemr_web_backup/emr_backup/openemr.sql “openemr”" returned -1:

dlee5400 wrote on Sunday, November 29, 2009:

line 196 replacement outcome:

Dumping OpenEMR database…

 
““C:/Program Files/MySQL/MySQL Server 5.1/bin\mysqldump” -u “openemr” -p"dlee5400” -opt -quote-names -r C:\WINDOWS\TEMP/openemr_web_backup/emr_backup/openemr.sql “openemr”" returned -1:

bradymiller wrote on Monday, November 30, 2009:

dlee5400,

This is a tough one, and odd that no error code is getting reported after the colon. Either related to the spacing and path separators or a IIS webserver issue (also a good possibility both are causing problems). On our side, we should test the spacing issue and path separators in paths in the mysql command and also in the temporary path (and fix if needed). I likely can’t get around to testing this for awhile, Bill, are you available to test/fix this stuff?

-brady