PHP Cron Job - Set created folder owner / group to Apache -


i have cron job executes shell script runs php program creates folders used internal site. issue job creates folders root owner , not allow access folder when user accesses application via browser. folders created correctly when created through browser app.

i have been trying different techniques site , others few days including using "apache" or "www-data" cron job, neither works. when use "apache" job appears in log, not executing script. when use "www-data" cron job not execute. tried switching user apache in script, error stating "this account not available".

environment: centos 6.2,,php 5.3.3

crontab entry executes , creates folder root owner

* * * * * root /path/script.sh >> /log/script.log 2>&1

entry "apache user" - shell not execute, no error messages

* * * * * apache /path/script.sh >> /log/script.log 2>&1

entry "apache user" - shell not execute, cron error 'bad username'

* * * * * www-data /path/script.sh >> /log/script.log 2>&1

shell script - executes when running root, creates folder root owner

`#!/bin/sh   script_path="/path"   php ${script_path}/code.php var` 

changed php execution line running cron root "this account not available" error

/bin/su - apache 'php ${script_path}/code.php var'


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -