Megool
Megool

Reputation: 999

When exec() fails, where can I find the error log

I am executing mysqldump in a php file. It worked fine in a local but is not working in a server. I suspected something is wrong with exec() permission or a file r/w permission, but haven't figured out the exact error yet. I want to check the error log or a message that command throws. How/where can I check these in php?

$command='mysqldump --opt -h '. $db['hostname'] .' -u ' .$db['username'] .' -p' .$db['password'] .' --databases ' .$db['database'] .' > '.$mysqlExportPath .' 2>&1';
exec($command);

EDIT: Suggested solution worked!

ini_set('display_errors',1);
error_reporting(-1);

Upvotes: 1

Views: 83

Answers (1)

Saloni Dhall
Saloni Dhall

Reputation: 96

you may on display_errors from php.ini or can add in your php source code file like as : error_reporting(-1);

So that you may get an exact error causing above function to be failed.

You may also check it should not be there in your disable_functions list under php.ini server configuration.

Upvotes: 1

Related Questions