PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I got the same 'Access is denied'. Not very strange though, since I was trying to write the dump to a directory instead of a file
You should also make sure that you're using windows short path names if you're running windows... e.g PROGRA~1 instead of Program Files... dir /X displays short names
regards tores
PS: Somewhere I read that backing up your db with shell_exec consumes a lot of memory. You should use system or exec instead.
Last edited by tores on Tue Aug 02, 2005 11:15 am, edited 1 time in total.
I'm no php genius, so ignore me if any of my suggestions are stupid.
tores said:
You should also make sure that you're using windows short path names if you're running windows... e.g. PROGRA~1 instead of Program Files... dir /X displays short names
I had a problem that there was a space in the directory name that was in my execute path. E.g. /var/lib/my program -l blah. Fixed it with something like /var/lib/"my program" -l blah
Other than that, if you are running apache, the server is it's own user, as I understand it. So when you execute the command in the shell, you are a different user than that which is executed through php served by the apache web server.
Not all php runs as apache - this script is run by the CGI version of PHP. So, the file is run as a cron job (meaning: as root). So, it's not a permissions thing. Even if it was, I don't think it's Linux permissions because the file is generating a MySQL error, not a shell error.
Thanks though - I can use all the brainstorming I can get.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
well MAYBE you dont have full permission on that database for that user from php....uhhhhh maybe be probebly not. i mean maybe there is another user that is being run from the php script and a different user from command line but probebly not. just thought i would put my 2 cents in
It might be a path var issue. If you call mysqldump at the command line the standard paths are available. If you call it by the script they might not. Provide the full path to mysqldump and it might work.