Page does not stop loading when I use exec in WAMP

1

I need to make a PHP script that runs a program on the server, but the page does not stop loading, it's like waiting for the process to finish.

I've been in services.msc and I put the apache process in order to interact with my desktop, however it goes to another session, as if it were not mine.

My code is as follows:

<?php
    exec('C:\teste.exe');
?>
    
asked by anonymous 27.02.2014 / 22:15

2 answers

1

According to the documentation of the exec() function , PHP waits for the command to finish executing because the returned value by the function exec() is the last line of this same execution.

    
27.02.2014 / 22:27
0

Exec waits for the end of the process to finish interpreting your code, a legal example for you to understand would be to test the notepad ("Windows Notepad.");

 <?php exec("notepad.exe"); ?>

As soon as you run it will open notepad, note that the page will be loading .... as soon as you close notepad the execution will end.

    
28.02.2014 / 17:38