shell-exec

calling shell_exec(“php myscript.php”) goes into infinite loop

若如初见. 提交于 2019-12-11 08:40:53
问题 I decided to fork out my php script because it takes too long to run. When I ran it shell_exec() call on a local linux machine, I did not see the infinite loop problem, but on a hosted machine, the script went into an infinite loop. I reduced the code to the minimum and I hope someone can help me see the problem here: 3 scripts are involved: test_shell.php --> issues shell_exec() to forkphp.sh --> which issues a command "path/to/php write_hello_world.php" starting from top to bottom order,

ImageMagick unix shell script doesn't work when fired with php shell_exec()

社会主义新天地 提交于 2019-12-11 07:50:01
问题 I have to create a transition sequence of images, using Fred's ImageMagick scripts,in particular fx transitions. In my php code, I resize all the images i got to a standard size, then I rename all those pictures to something like pic000001.jpg, pic000002.jpg, pic000003.jpg and so on (i keep count with $count), then I do: $frameIndex=0; $frames=18; //for all the pic000001.jpg, pic000002.jpg, pic000003.jpg.... do a transition //between them for($seq=1;$seq<$count;$seq++){ //here I take a

Downloading and saving file by using wget in shell_exec

Deadly 提交于 2019-12-11 07:43:29
问题 I want to download files from commandline when I run the command in shell it will work but when I want to execute it in PHP,No result $cmd='wget http://cvs.snort.org/viewcvs.cgi/snort/rules/dns.rules' $output=shell_exec($cmd); echo "<pre>$output</pre>"; I just wanted to download from this site any help would be appreciated how can i correct this? if the solution is Curl how can I write it 回答1: Use cURL. Like this. 回答2: file_get_contents( 'http://cvs.snort.org/viewcvs.cgi/snort/rules/dns.rules

Two commands successfully run manually but fail when run in shell_exec(), giving TimeOut error

情到浓时终转凉″ 提交于 2019-12-11 06:27:58
问题 I am trying to execute two dmd commands simultaneously using PHP shell_exec() . One command runs Tshark for 5 seconds. The second command runs an .exe file. Tshark is a program which captures network packs transferring over a network interface. The second program (named mtu.exe) sends network packets from my local machine to a remote machine. Thing is that when I run these commands manually , I run the first command. A moment after that, I run the second one, and all goes well and within a

running bash scripts in php

狂风中的少年 提交于 2019-12-11 06:14:05
问题 I have two computers. On the first computer I have apache running with all my web code. On the second computer I have large amounts of data stored with a retrieval script (the script usually takes hours to run). I am essentially creating a web UI to access this data without any time delay. so I call: exec("bash initial.bash"); this is a driver script that is in my Apache folder. It calls the script on the other computer. calling: ssh otherMachine temp.bash& this script invokes the data

PHP, shell_exec and an input

不打扰是莪最后的温柔 提交于 2019-12-11 02:09:02
问题 is it possible for shell_exec to execute a given command, where the initial command would ask the for a dynamic input then followed by a command that's based on the input itself. i've researched for hours for the answer and i can't seem to find what i'm looking for. i have a requirement that's similar to the idea of the example below and any help would be appreciated since $x = shell_exec("read -p 'Enter your name : ' x; echo 'Your name is' : $x"); echoing x outputs : your name is as you can

Powershell output to PHP variable using shell_exec

烂漫一生 提交于 2019-12-10 23:03:05
问题 I have a powershell script which outputs a video file duration. Running this script gives me the expected result. $Folder = 'C:\my\path\to\folder' $File = 'sample1_1280_720.mp4' $LengthColumn = 27 $objShell = New-Object -ComObject Shell.Application $objFolder = $objShell.Namespace($Folder) $objFile = $objFolder.ParseName($File) $Length = $objFolder.GetDetailsOf($objFile, $LengthColumn) Write-Output $Length In a php file, I'm trying to save this output to a variable. <?php $var = shell_exec(

Output of shell_exec gets truncated to 100 characters

好久不见. 提交于 2019-12-10 17:56:09
问题 When run in shell the following command, curl -F file=@filename http://192.168.0.1 produces the following output: Accuracy = 0% (0/1) (classification) Accuracy = 0% (0/1) (classification) Accuracy = 0% (0/1) (classification) Accuracy = 0% (0/1) (classification) verdict = success! When I run it in php, either by using shell_exec() , exec() or the backtick operator, $verdict = `curl -F file=@$filename $url`; I get the following output: Accuracy = 0% (0/1) (classification) Accuracy = 0% (0/1)

php shell_exec($cmd) do not run in a cronjob

自作多情 提交于 2019-12-10 11:43:14
问题 sorry for that (I believe) poor question, but google and other articles in this forum can't help me... I'll run the a php script with following code in it: $cmd="duck -u user_name -p pwd -parallel 1 -e overwrite -y --throttle 1024 --upload path to remote file absolute_path_to_local_file"; $shellResponse=shell_exec($cmd); This works well, when I call this php file in the browser. But it fails, when I call the script within a cronjob. With a cronjob i get following errormessage: sh:1: duck not

Can't import NLTK from within phps shell_exec

◇◆丶佛笑我妖孽 提交于 2019-12-10 11:24:46
问题 I have a python script being called form php's shell_exec command. All works well, except that it cannot import the NLTK corpora when called through shell_exec. The very same command is executed without problems however, whenever I call it directly from shell. I am using Debian 8. This is my php-Code: $cmd = "/usr/bin/python /var/www/include/sCrape.py -u '$my_url' "; $response = shell_exec($cmd); $response = json_decode($response, true); This command works well when called directly (without