Reputation: 67
Well I have a cron that runs a bash file:
#!/bin/bash
for n in {1..10}; do
/usr/bin/php /var/www/html/teste_sh.php v=$n &
done
But in this script teste_sh.php, If I do an error_log, it doesn't work.
Error_log of this folder is empty, but if I run http://localhost/teste_sh.php, error_log works fine!
Is there a way to make error_log work in this case?
Thanks.
Upvotes: 1
Views: 170
Reputation: 7054
Not exactly clear on where your error log is, but, It's a permission issue. The CRON assumedly is a crontab on your user, not root.
I would place your user in the same group as your web server, often www-data
.
Then the web server, and you when executing via CRON, will be in same group. Of course just need to make sure the directory /var/www/html is chowned to that group.
Add your user to web group:
sudo usermod -a -G www-data myusername
And then chown the directory
sudo chown -R myusername:www-data /var/www/html
Might be worth taking a look for an answer on https://serverfault.com/
Upvotes: 1