hello guys its been a while since my last question here :P am working right now on PHP script to upload and convert video files to several resolutions ( 360 - 720 ), here a piece of my php code to convert move_uploaded_file($file_tmp, 'upload/'.$fileName); add_to_queue($time,"360-".$fileName,$status="pending"); //where add_to_queue is simple function to add these information to queue table $cmd = 'ffmpeg -i upload/'.$fileName.' -vf scale=480:360 -c:v libx264 -q:v 1 -strict experimental -c:a aac -b:a 160k convert/360-'.$fileName.' >/dev/null 2>/dev/null &'; shell_exec($cmd); now everything here is ok and working great, but I need to check if the video encoding is completed and update …

Member Avatar
Member Avatar
+0 forum 1

I'm creating an application that with continuously attempt to run a list of programs until they are open. I'm having an issue when it comes to programs that require administrative priveleges however. I've done some searching and found the below script (in createElevationScript()) that *should* run a program with administrative priveleges, however it doesn't start the program successfully. Here's the relevant code: public void tryStart() { if (!checkRunning()) { try { ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.command(path); processBuilder.start(); } catch (IOException e) { System.out.println("ForceStartUp: Insufficient privileges to run ProgramEntry with Name '" + name + "' at Path '" + …

Member Avatar
Member Avatar
+0 forum 5

How do I use pipes to communicate with another proccess that is being run using an execl command? I know how I can send info to that process but how do I get info back from that proccess? Some more information on what Im trying to do: I am trying to write a small database program. There are two programs, one program is an interface program where one will write the commands, the other program, the database program, will take in the commands and process them. the interface program has a parent and a child process. The child is the …

Member Avatar
Member Avatar
+0 forum 4

Hello. I need to set up some pipes for a homework assignment as part of a bigger project. The issue I'm having is that the array (args) I'm using to populate the pipe arguments keeps segfaulting and I don't know why. Everything has been malloced beforehand and the faults only occur at the mentioned places. Below, the relevant code: char** args; char** pipe1_args; int pipe1_args_size; char** pipe2_args; int pipe2_args_size; while (temp_std_command && array_size <= 255) //take args and break them up into an array { args[i] = malloc(sizeof(char)*255); strcpy(args[i], temp_std_command); temp_std_command = strtok(NULL, " "); i++; array_size++; } i++; array_size++; …

Member Avatar
Member Avatar
+0 forum 2

HI, I am trying to convert an audio file that is in wav format to mp3 format. I have installed apache and I am using windows 8. I downloaded the files for ffmpeg and tried to run the php script and convert the file but no success. What I am doing is in the exec command I am giving the path to ffmpeg.exe and calling the convert command. Here is my code. $ffmpeg = $_SERVER['DOCUMENT_ROOT'].'/ffmpeg_test/bin/ffmpeg.exe'; exec($ffmpeg.' -i 10001_pre.wav file.mp3',$out,$return); Now when I try to print the out variable it does not show me any thing. Can any one tell me …

Member Avatar
Member Avatar
+0 forum 3

I'm trying to execute a binary on my Linux web server. The binary is called 'phantomJS' which is used mainly to create screenshots of a webpage. I logged into my cPanel and found the following information about my server: Operating system : Linux Architecture : i686 So I went ahead and downloaded `phantomjs-1.9.0-linux-i686.tar.bz2` from the phantomJS website. I also uploaded three more files to the same folder in which `phantomjs` was present: 1. **test.php** (which is the main file which will be executed in the browser) 2. **test.js** (which contains the code to start phantomjs) 3. **createScreenshot.php** (which contains code …

Member Avatar
Member Avatar
+0 forum 1

Hi All. Have been messing around with PDO for a while, but have come across a bit of a quandry. I like the prepare - execute method for fetching data, but I needed to check if an update query actually did update or not. Now not having mysql_affected_rows() to hand, I was left scratching my head. PDO:exec can do this, but it seems only on 'straight unprepared queries'. Does anybody here have any suggestions on the best way to implement a PDO::exec but on a prepared query? This is some cut-down of my code, so you get the idea: public …

Member Avatar
Member Avatar
+0 forum 3

What this produces and why? >>> a = 2 >>> b = 5 >>> exec "print(a+b)" in dict(a=6, b=9)

Member Avatar
Member Avatar
+1 forum 2

Is it possible to run command line exec in the foreground instead of the background with PHP?

Member Avatar
Member Avatar
+0 forum 3

I seem to be having a major problem with FFMPEG on my local test server everything seems to work fine the videos encode and everything. I moved all of this onto my new Windows 2008 Web Server, which uses IIS 7 and everything works I get no errors or anything but the exec command will not run ffmpeg. I have tried all the solutions that people have suggested with changing the permissions and the permission for cmd.exe but nothing seems to make it work. I know the code works as it has all been tested. If anyone can shed any …

Member Avatar
Member Avatar
+0 forum 4

hello! i use this command and run it on localhost in my pc <?php exec('mspaint "C:\path\to\image.jpg"'); ?> and this $cme='notepad.exe'; passthru($cme);

Member Avatar
Member Avatar
+0 forum 2

I am trying to run the following perlscript from php page. But unfortunately, it failed without giving any error. exec("PERL C:/Program Files/Zend/Apache2/htdocs/Scripts/test.pl"); But when I am trying the same perl command from command line interface, it runs successfully. PERL C:/Program Files/Zend/Apache2/htdocs/Scripts/test.pl Can anybody advise, where i am making mistake? I need to invoke the same perl command from php. Thanks in advance!! Content of test.pl #!/usr/bin/perl print "Hello World!\n"; Regards, Deepali

Member Avatar
Member Avatar
+0 forum 1

Hi, At the moment I am trying to open a log file with notepad.exe while the original process continues. As I am developing for Windows, fork() is not available for me. I googled alot and found a good reference to opening processes ([url]http://www.yolinux.com/TUTORIALS/ForkExecProcesses.html[/url]), however they all put the original process into a hold. For example: [CODE]exec("notepad.exe", "logs/Log.log", 0);[/CODE] or [CODE]system("notepad.exe logs/Log.log");[/CODE] All stop the original process. Does anyone know the way to fix my problem? I am developing on Windows XP and am using Code::Blocks as IDE. Thanks in advance, ~G

Member Avatar
Member Avatar
+0 forum 3

hi, how to call exe file with some parameters from java and save the output of the exe file in a specified path. Please let me know immediately..its urgent!!! I am using the following code : I want to save the file after running this DPAnalysis.exe on jan.xls into my file system. The .exe file is running properly by taking jan.xls but not saving it anywhere . Please help Runtime.getRuntime().exec ("C:\\Program Files\\DP\\DPAnalysis.exe "+"E:\\xlsdata\\jan.xls"); Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

Here is code to execute these printing commands from file: [CODE]talk("How Are You") bark("I am fine") bark("...and how are you") snarl("...sorry I asked") [/CODE] from file INPUT, do printing of results to screen without tags and to file with tags, and open the html output with webbrowser.

Member Avatar
+0 forum 0

Hi All, I wonder if anyone could help? I have a large Java program which needs at various points to run UNIX commands. The only wayI have found to do this is below (although I would have liked the program to output all terminal commands into the same window (shell) as the program is loaded in) - this code launches new shells silently in the background. The problem I have is that the code, launches this command and immediately continues to the next lines of code (it doesn't wait for this command to execute and complete before continuing). Due to …

Member Avatar
Member Avatar
+0 forum 5

Hi everyone, I'm a moderately experienced C coder trying to figure out the [B]execve()[/B] command. Here's the basic problem: My program takes a command from the user, loaded into the string UsrCmd. The string is tokenized and each token is loaded into ParaArray[]. Then ParaArray[] is used as arguments to call execve(). I think I also pass in the user's environment variables with envp[]. But here's the problem: If the user inputs a command without the full path to that command, execve() cannot find the associated system call and fails. It is obviously too cumbersome to ask the user to …

Member Avatar
Member Avatar
+0 forum 1

How can I get results from exec()? Any suggestions appreciated!!! [CODE] #!/usr/bin/python import socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) host = socket.gethostname() port = 1234 sock.bind((host,port)) while True: cmd, addr = sock.recvfrom(1024) if len(cmd) > 0: print("Received ", cmd, " command from ", addr) exec(cmd) # here how I can get results? print( "results:", <for example results printed here> ) sock.close() [/CODE]

Member Avatar
Member Avatar
+0 forum 5

hi, i have problems using exec(), I need to pass a set of numbers using exec to another program that is supposed to use them to calculate something,,, i dont know how to pass them any suggestions??

Member Avatar
Member Avatar
+0 forum 1

Hi, I want to take a command with its options as input and execute it with one of the exec() functions. My approach is to take input first and put it in an array by dividing with string tokenizer. Then I call execvp() which takes the array including the command as parameter. When I try my code with input "ls -l", I get the error below. [CODE]ls: invalid option -- ' ' [/CODE] I tried with different exec() functions just giving second element of array and giving path myself as "/bin/ls". But I can't make it work. There is a …

Member Avatar
Member Avatar
+0 forum 2

I want to launch a new process from a given string of input (including parameter). I tried to use system() but it appears that in the child process, getppid() is not the same as the caller in some runs (probably because system uses the shell as command interpreter). However, if I fork and then use exec(), it is complicated to parse the parameter. Anyone knows a way to get around this problem? Or is there any library that helps parse a string of input into program parameters like shells often do? Thank you very much in advance.

Member Avatar
Member Avatar
+0 forum 3

The End.