title: php exec('echo 1 > ~/cctv_config/cctvstatus') does not work
body: <p>Here is part of the code that I have in php file:</p>
  
  <pre><code>function checkSetStatus($checkSet) {
  
  //other if options here
  
      if ($checkSet == '2') {
          exec('echo 0 &gt; ~/cctv_config/cctvstatus.log');  
          sleep(1);
          exec('echo "$(date) | setOff" &gt;&gt; weblog.log');
          return (int) exec('cat ~/cctv_config/cctvstatus');
      }
  }
  </code></pre>
  
  <p>Problem is with line:</p>
  
  <pre><code>exec('echo 0 &gt; ~/cctv_config/cctvstatus.log');
  </code></pre>
  
  <p>When I trigger command </p>
  
  <pre><code>echo 0 &gt; ~/cctv_config/cctvstatus.log
  </code></pre>
  
  <p>in linux commandline, it works fine. However if it is triggered indirectly by exec function in php file it does not make any changes in targeted file.</p>
  
  <p>In apache error log file there is infomation that </p>
  
  <p><strong>file or directory ~/cctv_config/cctvstatus.log can not be created</strong> </p>
  
  <p>(I already changed mode of cctvstatus.log to 777). Similar information is logged as a result of triggering this line:</p>
  
  <pre><code>exec('cat ~/cctv_config/cctvstatus');
  </code></pre>
  
  <p>In this case it is logged that such file or directory does not exist (There is one more issue - in exec with cat I am wondering if rather passthru function should not be used).</p>