kool_samule Posted September 25, 2009 Share Posted September 25, 2009 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. Quote Link to comment Share on other sites More sharing options...
Bricktop Posted September 25, 2009 Share Posted September 25, 2009 Hi kool_samule, I'm pretty sure you need MySQL installed on the server to do a mysqldump. Hope this helps. Quote Link to comment Share on other sites More sharing options...
kool_samule Posted September 25, 2009 Author Share Posted September 25, 2009 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. Quote Link to comment Share on other sites More sharing options...
Bricktop Posted September 25, 2009 Share Posted September 25, 2009 Hi kool_samule, Have you correctly configured your PHP variables so it knows where MySQL is installed? Have a look at http://www.artfulsoftware.com/php_mysql_win.html for more information. Scroll to the bottom of the page and read the "Configuring PHP and MySQL under IIS section. Hope this helps. Quote Link to comment Share on other sites More sharing options...
kool_samule Posted September 25, 2009 Author Share Posted September 25, 2009 Hi Bricktop, Yes, MySQL is installed on the server, so too PHP which is configured correctly. Tested phpinfo.php and looks fine. Does my script look OK or have I missed something? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.