Jump to content

Backup MySQL PHP script


kool_samule

Recommended Posts

Hi guys,

 

I have a simple script that backup the contents of a database and place the file on the server.

The problem is that this script works fine on my Apache server, but not on the IIS server (HTTP 500 error).

Script:

<?php
$backupFile = "../DBJobs_" . date("Y-m-d");
$command = "mysqldump --opt -h localhost -u (user) -p(password) dbjobs > $backupFile.sql";
system($command);

if ($command) {
$mess = "<p>Backup file created!</p>";
}
else {
  $mess = "<p>There was a problem with the backup routine.</p>";
}
?>

 

Do I have to change the $command variable or the system function?

 

Any help would be very appreciated.

Link to comment
Share on other sites

Hi Bricktop,

 

MySQL is installed and working, I can connect to it fine, do all the usual stuff, add, edit and delete records.

 

On my development server (Apache) the $command works fine and runs, after migrating to the IIS server (and editing the connection settings), I can't seem to get this to work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.