i want to take backup of my database with a single click of user. I am using mysqldump to do so, It creates .sql file but not contain any thing int it. Here is the code. $backupFile = $dbname . date("Y-m-d") . '.sql'; $command = "mysqldump --opt -h $host -u $user -p $password $database > $backupFile"; $backupCheck = system($command); if($backupCheck) { echo ("Success"); } else { echo ("Fail bakcup"); } Plz help me , wat wrong with this code and how can i solve my problem I want to this on localhost and than on online website. How can i did it at localhost.
you can try exec() instead. if you still get the same error "unable to fork", check this user comment from t dot kramer at NOSPAM dot safetbus dot de (21-Sep-2006 09:21) at http://nz2.php.net/exec: Trying to us the following code failed badly with various results: like "unable to fork", "access denied", "empty results", depending on what settings I used, ... even though the same code worked from command line on the server itself. $retstr = exec('nslookup -type=mx myhost.com', $retarr); Instead of nslookup I believe this would apply to most programs from the \system32\ directory. I had to learn that the following finally worked: $retstr = exec('c:\php\safedir\nslookup -type=mx myhost.com', $retarr); ... but only under the listed preconditions: 1: nslookup.exe is placed (copied) in the directory \php\safedir\ 2: the directory \php\safedir\ is included in the system PATH environement variable 3: the file cmd.exe is placed in \php\ as listed by other notes above 4: the directory "c:\php\safedir\" is set in the php.ini setting safe_mode_exec_dir = "c:\php\safedir\" .. maybe set in php-activescript.ini as well, depending on your system setup. 5: nslookup is referenced by the full path as otherwise the file from \windows\system32\ will be called. This happend to me with empty result due to missing rights! Hope this helps somebody saving some time and headaches. Thomas Code (markup):