Note that there are some explanatory texts on larger screens.

plurals
  1. POphp exec() is not executing the command
    text
    copied!<p>I have tried to use <code>exec()</code> with <code>'whoami'</code> to check if it works and I got the result of </p> <pre><code>nt authority\system </code></pre> <p>Now I need to run a <code>.exe</code> file with parameters from <code>php</code> via <code>exec()</code> function. </p> <p>I tried this in <strong>command prompt</strong> and it actually runs the program with given parameters. This is the example command. </p> <p><br><strong>NOTE</strong> the exe file gets 3 inputs (folder, file_name, report_file_nmae)</p> <pre><code>&gt; ..\..\some_file.exe folder="C:\path_to_folder" param=1.xml report=2.xml </code></pre> <p>But when I run this command from <code>php</code> file:</p> <pre><code>exec('..\..\some_file.exe folder="C:\path_to_folder" param=1.xml report=2.xml'); </code></pre> <p>nothing is happening. This is the first time I am using exec() function, so I am not familiar with its details. <strong><em>What is wrong?</em></strong> </p> <p>I tried using:</p> <ul> <li><code>\\</code> instead of <code>\</code></li> <li><code>escapeshellarg()</code> on the directory</li> <li>added <code>""</code> around directory folder names</li> </ul> <p>No luck </p> <p><strong>Addendum:</strong></p> <pre><code>echo exec($command) // echos &lt; .... why? </code></pre> <p>or</p> <pre><code>exec($command, $output); print_r($output); // Array() </code></pre> <p>I even changed the permission on the file to full control to all users. If I call the program from <code>command prompt</code>, I can see the icon appearing next to clock for a second. </p> <p>But the same call from <code>php</code> will not even call the program. </p> <p><strong>Edit</strong></p> <p>Even <code>exec('notepad.exe');</code> is not working. Something has to be done with <code>php</code> configurations maybe?</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