Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP exec to run a file
    text
    copied!<p>I am trying for last 3 hours to tell PHP to run a simple file. I am using wamp server for windows in local host (Windows 8)</p> <p>I've tried with <code>exec()</code> working with:</p> <pre><code> echo exec('whoami'); </code></pre> <p>I got response nt authority.</p> <p>Also tested with:</p> <pre><code>if(function_exists('exec')) { echo "exec is enabled"; } </code></pre> <p>So it probably works?</p> <p>I am trying to run a file called tester.php</p> <p>When I include it, its working, when I require it its working. I need to execute it in background. When I refresh file, code is working without any error, it writes to the database normally.</p> <p>When i try to exec it its not working.</p> <p>I tried :</p> <pre><code> exec("php http://localhost/diplomski/program/defender/tester.php"); exec("php-cli http://localhost/diplomski/program/defender/tester.php"); exec("http://localhost/diplomski/program/defender/tester.php"); </code></pre> <p>Not working, also tried:</p> <pre><code> exec("php http://127.0.0.1/diplomski/program/defender/tester.php"); exec("php-cli http://127.0.0.1/diplomski/program/defender/tester.php"); exec("php-cli d:\wamp\www\diplomski\program\defender/tester.php") </code></pre> <p>Not working also tried: </p> <pre><code> exec("php tester.php"); exec("php-cli tester.php"); exec("tester.php"); </code></pre> <p>Also tried:</p> <pre><code> $WshShell = new COM("WScript.Shell"); $oExec = $WshShell-&gt;Run("D:\wamp\bin\php\php5.3.13\php-win.exe -f d:\wamp \www\diplomski\program\defender/tester.php", 0, false); </code></pre> <p>Tried this, its refreshing infinitely and not working:</p> <pre><code> exec("php d:\wamp\www\diplomski\program\defender/tester.php"); exec("php-cli d:\wamp\www\diplomski\program\defender/tester.php"); exec("d:\wamp\www\diplomski\program\defender/tester.php"); </code></pre> <p>I'm starting to pull my hair out here. First time I'm trying to use <code>exec()</code> and I'm not very good with it or with the commands. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload