hai all,

    I need to run the exe file which is stored in client machine, how can i execute it from our php code?

     I have used exec(), system(), passthru() and many of things which in program execution part in php manual, But i cant run this exe...

     Can any of you give me a solution for this?.....

thanks if any advice...

    Server-side code (PHP) can't run client-side applications.

    This is the nature of PHP (& other server-side scripts). When a client sends a request, he actually doesn't really care how the HTML is getting generated on the server (i.e. with PHP, ASP, JSP, etc); all he cares about is the HTML that comes back, and HTML can't "do" anything with the computer.

    Also, imagine what a wreck it would be if websites you visited could run programs on your computer!

      ok than what is the use of exec and other program execution commands in php?

        They are used to run scripts and OS commands resident on the server. For example, on a Linux machine, you can rm -f somedirectory and delete a directory and the files it contains.

          If you want to run the files , i think you need to use VbScript

            Please remember that .exe files are WINDOWS executables, and as such will not run on a linux system without help.

            as has been pointed out, exec() is to run linux commands.

            if you happen to be running php on a windows system, then this increases the possibilities of success if you are trying to run an .exe from your php installation.

            however, there is a major scupper to your plan: PHP is a server side script. you cannot get a client computer to run a php script you supply, much less control the client computer to force an application to run.

              stevesweetland wrote:

              as has been pointed out, exec() is to run linux commands.

              Only on a linux system. On a Windows system, it runs Windows commands.

              stevesweetland wrote:

              much less control the client computer to force an application to run.

              Actually... if you use the PsExec program from the PsTools back, and you have administrator privileges on the remote computer, you can remotely execute a file if you know the path to it on the remote computer.

                ya we know the path of each exe file in remote system , can you please send me how we execute it?...........................

                  Here is a link to the documentation for PsExec. It has a list of command switches and even examples at the bottom.

                    Write a Reply...