Database sql restore problem

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Database sql restore problem

Postby Tee shot » 11. November 2016 20:31

hi,

I use a script to restore my database to my host, but I can not manage it under xampp, I do not understand or is the problem.

Code: Select all
$host= 'localhost';
         $user= 'root';
         $pass= 'my_passl';
         $db= 'my_base';
         //$db_charset = "utf8";
         $chemin = getenv('DOCUMENT_ROOT').'/admin/sauvegarde_mysql/';
         // Décompresser le gzip et l'importer dans la base de données
         system(sprintf(
         'gunzip -c %s/'.$_GET['fichier'].' | mysql -h %s -u %s -p%s %s',
         $chemin,
         $host,
         $user,
         $pass,
         $db
         ));


Thank
Tee shot
 
Posts: 3
Joined: 11. November 2016 20:25
XAMPP version: 5.6.19
Operating System: Windows

Re: Database sql restore problem

Postby tm01 » 11. November 2016 21:01

is it a code from a linux environment (or did you install "gunzip" as a sys variable)?
why don't you just use phpmyadmin to restore your backup?
you should provide your log files (apache error.log and php_error.log) and not just your php code.
tm01
 
Posts: 35
Joined: 03. November 2016 16:20
XAMPP version: 3.2.2
Operating System: Win7

Re: Database sql restore problem

Postby Nobbie » 11. November 2016 21:33

Tee shot wrote:I use a script to restore my database


But this is not a script from Xampp. Ask the author of the script, if something is going wrong.
Nobbie
 
Posts: 9562
Joined: 09. March 2008 13:04

Re: Database sql restore problem

Postby Tee shot » 11. November 2016 22:38

Thanks for your answers.
Here is the extract of the log file: 'gunzip' is not recognized as internal command
Or external, an executable program or a batch file.
I can't go through phpmyadmin, I need a script that could work just online and locally.

Thank
Tee shot
 
Posts: 3
Joined: 11. November 2016 20:25
XAMPP version: 5.6.19
Operating System: Windows

Re: Database sql restore problem

Postby tm01 » 11. November 2016 22:49

Well, thats the problem.
Your script requires at least gunzip and mysql as global terminal commands. So its not a problem of xampp, apache, php or anything else related to this forum - its an issue with your code and your system environment.
i don't know what you are trying to do or why you can't use phpmyadmin (its accessible local and online if you wish), but i think you should look for a different way or other scripts that are working with native php commands and not with external resources. For example I don't know why your script is executing the systems mysql instead of using php's mysqli syntax.
tm01
 
Posts: 35
Joined: 03. November 2016 16:20
XAMPP version: 3.2.2
Operating System: Win7

Re: Database sql restore problem

Postby Tee shot » 12. November 2016 00:06

Gunzip is not recognized under xampp?
It's a shame I'll look for another way, but I need to go through a script.

Thank
Tee shot
 
Posts: 3
Joined: 11. November 2016 20:25
XAMPP version: 5.6.19
Operating System: Windows

Re: Database sql restore problem

Postby tm01 » 12. November 2016 00:14

you can set an environment variable if you manage to install gunzip on your system. but i don't know if gunzip for windows even exists.
it has nothing to do with xampp, apache, php or anything else.
Lets give you an example: You sit at home in europe and look through the window of your living room. You've heard some people see palm trees and camels. Now you ask your architect whats wrong with your house or your window in your living room. The architect will tell you the same like we did here: plant a palmtree and buy a camel for your garden or move to a house in egypt. There is nothing wrong with your house or your window.
tm01
 
Posts: 35
Joined: 03. November 2016 16:20
XAMPP version: 3.2.2
Operating System: Win7

Re: Database sql restore problem

Postby Nobbie » 12. November 2016 12:59

Tee shot wrote:Gunzip is not recognized under xampp?
It's a shame I'll look for another way,


OMG....

It is not a question of Xampp, you are running a script which obviously is designed to run under LInux (and not under Windows). Windows(!) does not recognize "gunzip", its not a Xampp issue. Got it?! There is no "gunzip" in Windows.

Simply move your project to a Linux PC, install Xampp and run the script - eh voila, you will see, Xampp recognizes "gunzip" under Linux...
Nobbie
 
Posts: 9562
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 19 guests