A
A
Andrey Veryaskin2016-12-03 14:10:24
PHP
Andrey Veryaskin, 2016-12-03 14:10:24

Why can't a backup of a database table be done via shell_exec?

I make a backup of the database table with the command
mysqldump -u dbuser -pdbPassword dbName tableName | gzip > `date +{$rootDir}_service/dbbackups/$folder/tableName .%Y-%m-%d.%H-%M-%S.sql.gz`
If I run the command in the console, everything is fine, but if I run the command through shell_exec, then the archive is created with a size of 20 bytes. this is clearly not a complete archive. Why doesn't it work through shell_exec, what are the possible reasons?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Fedoseev, 2016-12-03
@martin74ua

conveyor is not working. Because it is provided by the shell (/bin/bash and the like) and you run the command without it.

A
Andrey Veryaskin, 2016-12-05
@veryaskinan

Clarification: even when I run the php script itself through the console, everything is fine, but when this script is run through the browser, mysqldump creates an empty file, and if you use gzip compression, then the file is 20B in size

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question