Running PHP code from erlang [closed] - php

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am trying to run PHP script from erlang code.Can anybody explain with a simple example?
I am basically trying put some data on google server via this php script.

Since Erlang webserver (Yaws) CAN run PHP scripts, this is an example.
first on the yaws.conf, write this.
the env variable.
php_exe_path = /usr/bin/php-cgi
Also be sure you enable the php processing for the individual server, like this.
<server www.example.org>
port = 80
listen = 0.0.0.0
allowed_scripts = php yaws cgi
</server>
Yaws will invoke the php-cgi binary and talk the CGI protocol to the
binary.
And thats all, you can run PHP Scripts into Earlang WebServers (Yaws)

Related

How to stop Telegramm bot if terminal has been closed? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed last month.
Improve this question
I use PHP "badfarm/zanzara" Telegramm-bot. I had started it by terminal in browser on my Fornex hosting with command php start_bot.php which refers to script "start_bot.php" execution. After that I have closed terminal but the bot did not stop. It has been running several days by now. How could I stop the bot?
Here is an approximate code sample (it's more complicated in real script):
Download and install htop
Start htop by the same command
Press F4 and input php start_bot.php then press ENTER
F9 and select SIGKILL
Done

WebSocket PHP works fine on Local but not when setup on a server for public [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I've setup a websocket server on local, and I'm able to make request on it. 127.0.0.1:2345,
But when setup the WebSocket on a AWS Ubuntu 18 server, I'm unable to make request at the 1.2.3.4:2345 (Assume that's my server IP).
What is the step that I might be missing?
It was just a matter of whitelisting the post 2345 in the security groups in AWS attached to the instance.
I thought I had to do some NAT or something. But it wasn't the case.
Whitelisting port in the EC2 security group. is the solution.

launch browser via php code [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Is it possible to invoke the browser via php code ?
Thank you in advance.
PHP is processed by the Web server. The browser is a client application on a client machine. The server cannot launch a client application without having a helper application in place and running on the client machine. Any other architecture would be very bad from a security standpoint - the client machine would have no control over who could run an application on their machine.
if you use firefox, you can use this:
pclose(popen('firefox -url http://www.example.com/reader.php?code=12345 &', 'r'));
other browsers have different console arguments, so you can try it yourself.

Running shell script automatically in UNIX / linux server [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I want my web server to run a .sh script that runs a series of .jar files. I want this to happen as soon as the server is contacted without any input from the user. A PHP or JS script would be preferable. Is it even possible to do this?
Thanks in advance
You can also look at gearman.org. It is safer and more flexible than shell_exec().
It is not doable in JavaScript, but you can use PHP for it. If I understand your question well, you have some utilities written in Java and you don't care about their output. The shell script would look like as follows:
#!/bin/bash
java -jar your-jar1.jar
java -jar your-jar2.jar
...
and provided the name of the script is myScript.sh and it has the x flag set, you can run it from PHP by:
shell_exec('path-to-script/myScript.sh');
<?php
exec ("sh your_script.sh");
?>
place this in your webserver root as a php file and replace your_script.sh with the name of your script.
WARNING: if you don't protect the script with a password, using for example a .htaccess file for Apache (http://httpd.apache.org/docs/current/howto/htaccess.html), anyone can execute that script.

Is it possible to run internal application xx.exe on click of a link [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In my project simply I want to run local application as netbeans or word document installed in my computer on click of a link? Is it possible ? If yes how am I to do it? If no why it's not possible.
Thanks in advance.
You can link to a PHP script and then in this script use exec() to run your application.
<?php
exec('path/to/your/app.exe -possibleparam -param2');
/* EOF */
I don't know if it is that what you are looking for:
http://www.php.net/manual/en/function.exec.php
exec will execute the app in the machine where the php is installed (so your server).
If you mean that the php should open an app on the user pc while he's surfing on your site, no.
The only way to to this is an NPAPI plugin. And use Javascript, not PHP.
PHP runs on the server. It has no control over the client. This is by design. If web pages could run programs on the client computer then it would be abused to an unlimited degree, for spam, viruses, and junk.
You can use the exec function to run a program on the server. If your server and client happen to be running on the same local computer, then this will do what you want.

Categories