Run a. EXE file on Windows from a PHP application on an external server

Asked

Viewed 2,883 times

1

I am with a SMS Gateway (Gammu) properly installed and running on my local machine at home.

I need my PHP Script hosted on a server to run this application on my local SMS server. How should I proceed?

Do I need to apply some type of permission in Windows for this? How should I pass the path for PHP to have access to this file .exe ?

2 answers

1

PHP alone does not do this. The most you will get is to run through javascript:

<script>
function abrirArquivo() {
document.location.href = "C:/Program Files/caminho/arquivo.exe";
}
</script>

This way you will also open a dialog box asking if you want to run the file. For security reasons it is not possible to open automatically. At least I never saw until now.

  • His answer by the title of the question is considered correct, but I think he wants you to execute a command in Gammu as if it were a "service".

1

I imagine you have a server at your house, where Gammu must be running.

By being in your home the Gammu, and your home probably use a home link with the internet, you have a dynamic IP address in your residence.

Therefore, in the first place, it is necessary to register a dynamic DNS pointing to your home. Use a service like No-Ip or Dyndns. You will have to install a program on your home computer, preferably on the same computer as Gammu (since you probably won’t turn it off).

Once this is done, you need to configure your router to direct ports to your computer with Gammu. See in the documentation of the software that communicates with Gammu which network ports are used. Note that this application acts as a server, taking commands and passing them to Gammu to run. If you do not have it, you will need one. I don’t know any, so I won’t recommend it, but Google quotes a few. Otherwise, build your.

There are classes that communicate PHP with Gammu, but PHP needs to run on the same computer as Gammu. Therefore, a solution would be to also install a webserver on the computer with Gammu. On your hosting server, you would send commands to the Gammu server, and this in turn would send commands to Gammu.

Whether you use a PHP communication code with Gammu or not, you will need an application on your home server to interface with Gammu and your remote webserver, as well as the settings on the router and dynamic IP.

  • To complement your answer, http://answall.com/a/50934/3635 note that the example is for Apache, but can be easily adapted to other software that supports TCP (and in some cases UDP).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.