It's working when i move the file to app current directory
$cmd = 'grep "Finished" sync.log | tail -n1;';
$exe = shell_exec($cmd);
error_log($exe);
Output:
I, [2020-01-27] INFO -- : Finished
but when i try to specified the direcotry, it doesn't work
$cmd = 'grep "Finished" /var/log/sync.log | tail -n1;';
$exe = shell_exec($cmd);
error_log($exe);
Edit Found this https://www.linode.com/community/questions/18703/getting-error-failed-to-open-stream-permission-denied How to fix Error: laravel.log could not be opened?
Then
semanage fcontext -a -t httpd_sys_rw_content_t "/var/log/sync.log"
restorecon -rv /var/log/