Answer the question
In order to leave comments, you need to log in
Reloading mysql from PHP/exec, how?
There was a need to restart mysql
wrote a small PHP script that, under certain conditions, does
exec('service mysqld restart');
the script is hung on cron from under the root to run once a minute
*/1 * * * * /usr/bin/php -f /var/[webpath]/mysql_restart.php >/dev/null 2>&1
and .. nothing - PHP fails to do this, banal
exec('service mysqld status > out.txt');
leads to the fact that "emptiness" is written to the file, but the banal
exec('whoami > out.txt') in the same file, easily writes to out.txt - 'root'
tell me where is the plug?
Answer the question
In order to leave comments, you need to log in
Or maybe this is a hint to you that you do not need to overload mysql (why did you need it)?
Add 2>&1 to redirect errors to a file as well.
You are most likely not running as root, and not root does not have rights to reboot services.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question