Re: mysqldump problem from PHP

From: Date: Mon, 23 Oct 2006 15:37:52 +0000
Subject: Re: mysqldump problem from PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-243479@lists.php.net to get a copy of this message
Edward Kay wrote:
Angelo Zanetti wrote:
hi all, Im doing the following dump through PHP: $output = shell_exec('mysqldump '. $db_database .' > '. $backup_path.$filename); It doesnt seem to work but when I run the exact same command (with appropriate values) in the command line it creates the dump file. What could be the reason for this? Thanks in advance. regards
     
It appears that it could be because the user that runs the scripts is not allowed to. When I run them on the commandline, I run them as the root user. Is this a common problem? What would the best way be to sort this out keeping in mind security on the server?
If you are trying to automate backups of you database, set up a cron job. I have a shell script that dumps my databases, zips them and then sends them via FTP to a remote server. This is automatically run every 12 hours by cron. See http://en.wikipedia.org/wiki/Crontab for more info. Edward
hi Edward, yes I know of CRONtabs but wont this still leave us with the user permission of running mysqldump? because essentially it will still be a PHP file to run the shell command to create the dump file? thanks

« previous php.general (#243479) next »