i've programmed a mysql backup system for my CMS which dumps all开发者_如何学运维 the DB data and structure into a gzipped .sql file:
$filename = DB_NAME.'_'.date('Y.m.d_H\hi_(s.'.round(microtime()*100,0).')').'.sql.gz';
exec('mysqldump --default-character-set=UTF8 --opt --compress --host='.DB_HOST.' --user='.DB_USER.' --password='.DB_PASS.' '.DB_NAME.' | gzip > '.DIR_BACKUP.$filename);
It works fine on my development server, but when i try to run the same code in my production server, the file is never created. Is this a permission issue? What should i configure for it to work? Thanks!
--- It seems the problem relies on the exec() function. Where can i allow permission for php to run that function?
Could be a permission issue, either you can't write to the filesystem, or more likely (certainly if your on a shared hosting service) the use of the exec command is not allowed. I believe you can check that with php_info();
Do you not get an error message? If not maybe enable displaying of error/warnings etc in php
sounds like a permissions issue. Have you tried setting DIR_BACKUP to /tmp or similar?
精彩评论