 <p><code>exec</code> is for executing system functions, not for running scripts. (Take a look at the manual, it's helping: <a href="http://php.net/manual/de/function.exec.php" rel="nofollow">http://php.net/manual/de/function.exec.php</a>)</p> <p>To achieve what you want, you could pass the path to php executable and add the script as parameter, like this:</p> <pre><code>&lt;?php $phpExecutable = 'C:/xampp/bin/php.exe' $path = 'C:/xampp/htdocs/user/execute.php'; exec($phpExecutable." ".$path, $output,$return); var_dump($return); echo "hi"."&lt;br&gt;"; echo "end";?&gt; </code></pre> <p>Should work. I do not know where your php executable is located, so please adapt it to your location.</p> <p>Happy coding.</p>