title: Cronjob with php script to execute bash command
body: <p>I have a cronjob that executes a this php script. The check for the httpStatus works fine. The Big problem is the execution of the bash command. (else) Is there something wrong?</p>
  <pre><code>&lt;?php
      $url = &quot;https://xxx&quot;;
  
    $handle = curl_init($url);
    curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);
    
    /* Get the HTML or whatever is linked in $url. */
    $response = curl_exec($handle);
    
    /* Check for 404 (file not found). */
    $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
    
    if($httpCode == 200) {
        /* Handle 200 here. */
        $output = &quot;Status 200 OK&quot;;
    }
    else{
        $output = shell_exec('cd public_html/redmine/ &amp;&amp; bundle exec ruby bin/rails server -b webrick -e production -d');
        
    }
    
    curl_close($handle);
    
    /* Handle $response here. */
  
  echo($output);
  
  
    ?&gt;
  
  </code></pre>