1

hello i have a php file which duos some number crunching and gets called from a different php file like this

$exc = "nohup nice php -f " . PATH . "/download.phtml $data $data1 $data 1>/dev/null & echo $!";

In that file i have a file_put_contents function call like this

if(file_put_contents(PATH."/tmp/generated/".$queue->output_value, $data)){
                        $queue->saveData();
                    }else{
                       // write down the file path
                    }

And all works great on my test rig. But as usual when i put it on the live rig it fails... the file write fails.

I double and triple checked the path is 100% correct and the folder in which the write should be is set to 777(just to get it working) But still no lunch fail write fails...

I heard about umask but im not sure if tht works over shell executed comands....

Suggestions are welcome.

ps. The working rig is Debian.

altendky
  • 4,176
  • 4
  • 29
  • 39
Sangoku
  • 1,588
  • 2
  • 21
  • 50
  • on errors the put_file_content just fails. – Sangoku Jan 11 '13 at 09:51
  • and nohup gives no return data. – Sangoku Jan 11 '13 at 09:54
  • `file_put_contents` throws a warning when it fails: http://rudiv.se/stack/fpc.php – Rudi Visser Jan 11 '13 at 09:54
  • nohup gives no data back. – Sangoku Jan 11 '13 at 09:54
  • Well it could be many things, remember `shell_exec` doesn't run in `/bin/bash` (assuming your server is setup correctly), so you may well be failing at the redirect portion of your execution. Are you sure that the script is even running in the first place? – Rudi Visser Jan 11 '13 at 09:56
  • The which gets called dous some db inserts which occure so the file gets executed correctly, and the path gets stored for debug resons to and all is ok! – Sangoku Jan 11 '13 at 09:58
  • 1
    Maybe check directory permissions. This is probably similar problem: http://stackoverflow.com/questions/4917811/file-put-contents-permission-denied – martin Jan 11 '13 at 11:29

1 Answers1

0

Ok to all who get this error.

if you change permisions of the folder to 777 and it dous not let you create files and the umask function is of no help to... then you are probably stuck with the

www-data user run process which cant write anywhere except in his domain... sux ha?

so you need to change your folder with folowing action

chown -R www-data.www-data /location of the folder....
Sangoku
  • 1,588
  • 2
  • 21
  • 50