'exec() didn't write file. (Returns '2' if try to write file with mysqldump)
I'm trying to make a dump of a database with mysqldump called by an exec():
$exec= exec('mysqldump --user=myUser --password=myPassword --host=myHost myDatabase > /pathto/www/myDumpfile.sql, $output, $return);
The myDumpfile.sql is not written, and var_dump shows:
$exec: string(0) ""
$output: array(0) { }
$return: int(2)
- The exec() is enabled on the system and runs well if the called program doesn't need to write a file.
- My code worked fine on Strato-server but after moving to 1blu I get this error.
- Writing some file to directory (/pathto/www/) works, if it is not done with exec() but with fwrite().
- I think I found out that there is a permissions issue. The trail leads to 'www-data', but I don't understand what that means. (But 'www-data' may be a false track.)
Can someone explain what 'www-data' is all about and/or how I can fix the error.
Thank you for helping!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
