exec

List to String to List Python 3

北慕城南 提交于 2020-01-07 06:54:56
问题 I need to convert a list into a string and then do the reverse process. Note that one script will convert List->String and another script will convert String->List, so store the list in a variable is not a solution. Use split(', ') or similar is not a solution either in all cases. So, as a challange I invite you to do the conversion in the following example: l = ['ab,.cd\'ac"', b'\x80', '\r\nHi, !', b'\x01'] str_l = str(l) I have tried one thing that worked: using exec() built-in function but

is it possible to run assimp commandline tool with the php

丶灬走出姿态 提交于 2020-01-07 05:03:35
问题 I used following command to convert the 3d models with the assimp Assimp, and it is working fine on Windows: assimp2json seaknight.obj seaknight.json I need to know how can I run this command from the PHP? I know that there re functions to run the shell execution from PHP, but it didn't work and I don't get any error. PHP code is used is follows. system("D:\assimp2json-2.0-win32\Release\assimp2json.exe assimp2json seaknight.obj seaknight.json"); and another one is $old_path = getcwd(); chdir(

Convert videos in background php ffmpeg?

邮差的信 提交于 2020-01-07 04:27:13
问题 I would like to convert videos with exec(), FFMPEG php. I would like to run the script in background. How can I do that? /*** convert video to flash ***/ $v = date('H-i-s'); // exec("ffmpeg -i uploaded_files/770530705510e88ec723a3-20130111_1221_43.avi -ar 22050 -ab 32 -f flv -s 320x240 flash/".microtime()."video.flv 1> flash/".$v."_block.txt 2>&1"); $cmd = 'ffmpeg -i uploaded_files/770530705510e88ec723a3-20130111_1221_43.avi -ar 22050 -ab 32 -f flv -s 320x240 flash/'.microtime().'.flv';

how to set environment variable when execle executes bash?

二次信任 提交于 2020-01-07 02:43:18
问题 Here I tried to spawn bash using execle() and wanted to set TMOUT environment for the new bash. It worked well. I could see TMOUT environment variable from the new bash shell. <example1> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int main(void) { char *env[] = {"TMOUT=60", NULL}; execle("/bin/bash", "bash", NULL, env); return 0; } But if I do the same thing like example2 to use sudo, I cannot see TMOUT environment variable from the new shell. <example2>

php exec python script that imports numpy

帅比萌擦擦* 提交于 2020-01-06 08:27:06
问题 I need a php script to execute a python script. Now the python code looks like this: test.py import sys try: import numpy print 'Numpy was loaded' except: print 'Could not Load Numpy' All the following commands print 'Numpy was loaded': $python test.py $python2.7 test.py PHP Script: exec('python test.py',$output,$ret); var_dump($output); The PHP script works if the line 'import numpy' is removed. I have tried the following things: Use absolute path in php script : exec("/usr/bin/python /home

PHP shell exec not working in html browser but working on cmd prompt

十年热恋 提交于 2020-01-06 06:50:06
问题 I am running PHP 5.2.14 on Apache/2.2.16 (Win32) and I have a script to run a shell command, which when tested in the command prompt works well but in browser mode (html), it doesnt. Scripts: mybatfile.bat REM ... REM process some folder details REM code which does not work in browser mode but works in cmd mode C:/somfolder/bin/mysqldump -u abc -pabcdef --result-file="C:/Apache22/somfolder/DBbackup/DBbackup.%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%.sql" --dump-date --log-error="C:/Apache22/somfolder

Command Line Arguments not getting executed in C

六眼飞鱼酱① 提交于 2020-01-06 06:33:06
问题 I am trying to pass arguments to execl() function for ls command. But when I pass /bin/ls -l -a as arguments to my program, the execl() function doesn't recognise the last two arguments. Why is that?Here is the code: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i,childpid; if(argc!=4) { printf("you didn't provide any commandline arguments!\n"); return 0; } childpid=fork(); if(childpid<0) { printf("fork() failed\n"); return 0; } else if(childpid==0) { printf(

PHP's exec() not executing command for FFmpeg

大兔子大兔子 提交于 2020-01-06 02:32:29
问题 I have installed ffmpeg on my server and it works fine via my terminal. I'm able to successfully convert a file to webm format, so I'm sure the installation is fine. I'm also sure that I only have one installation of ffmpeg installed on my machine. A problem arises when I try to convert files through PHP via PHP's exec(). When I run the same commands, I ran in the terminal, nothing happens. I looked around stackoverflow and other parts of the net for some help. I tried this to see the output:

conversion from mp3 to ogg using php

我怕爱的太早我们不能终老 提交于 2020-01-05 07:39:19
问题 I want to convert mp3 file to ogg. I tried the following code exec("/usr/local/bin/ffmpeg -i 1.mp4 -vcodec libtheora -acodec libvorbis testjohn4545454.ogg",$output); var_dump($output); But it does not convert the file and it only returns array(0) { } and it only takes a little execution time. But the conversion is success when using ssh command. Please give me solution. 回答1: Funny thing here, you want to execute this in it's own process and in the background , otherwise your PHP script will

conversion from mp3 to ogg using php

杀马特。学长 韩版系。学妹 提交于 2020-01-05 07:39:06
问题 I want to convert mp3 file to ogg. I tried the following code exec("/usr/local/bin/ffmpeg -i 1.mp4 -vcodec libtheora -acodec libvorbis testjohn4545454.ogg",$output); var_dump($output); But it does not convert the file and it only returns array(0) { } and it only takes a little execution time. But the conversion is success when using ssh command. Please give me solution. 回答1: Funny thing here, you want to execute this in it's own process and in the background , otherwise your PHP script will