shell-exec

PHP shell_exec wait for script to done? [duplicate]

给你一囗甜甜゛ 提交于 2019-12-13 23:17:24
问题 This question already has an answer here : PHP shell_exec wait for script to finish? [duplicate] (1 answer) Closed 4 years ago . I have a PHP script that queries a database for a list of jobs to be done and fires off other PHP scripts based on what it finds in the database (basically a process queue). Some of the scripts that the queue runner script executes may take 30 seconds or so to finish running (convert video, resizing images, etc). The problem is that shell_exec() in the queue runner

c++ equivalent for php shell_exec

ぐ巨炮叔叔 提交于 2019-12-13 18:14:31
问题 What will be the C++ equivalemt command for below mentioned php command: $command = shell_exec("sqlldr {$connect_string} control={$ctl_file_name} log={$log_file_name}"); 回答1: So based on your comments a solution that would work would be to use popen(3): #include <cstdio> #include <iostream> #include <string> int main() { // Set file names based on your input etc... just using dummies below std::string ctrlFileName = "file1", logFileName = "file2", cmd = "sqlldr usr/pwd@LT45 control=" +

shell_exec empty response for nslookup query

若如初见. 提交于 2019-12-13 16:08:20
问题 I am using Ubuntu and xampp, I am trying to execute the command nslookup gmail.com via. PHP, but I am getting an empty response. The same thing worked while I tried on a windows machine as well as in a Linux server running CentOS. FYI nslookup gmail gives proper response when I run the command directly on my terminal, the problem is only when I try to do it via. php. I even tried doing a which nslookup and then $nslookup = shell_exec("/usr/bin/nslookup $server"); with no help, but the same

OfficeToPDF not executing via shell_exec

守給你的承諾、 提交于 2019-12-13 05:29:13
问题 I am executing the command in by localhost on the command line as: OfficeToPDF.exe C:\wamp\www\editor\uploaded\uploaded_files_21_original\AffidavitinDIR-4.docx C:\wamp\www\editor\uploaded\uploaded_files_21_original\pdf\new2.pdf This runs fine and provides the necessary result. However, when I run it through php as: shell_exec('OfficeToPDF.exe C:\wamp\www\editor\uploaded\uploaded_files_21_original\AffidavitinDIR-4.docx C:\wamp\www\editor\uploaded\uploaded_files_21_original\pdf\new2.pdf'); It

Why shell_exec executing more than 1 process?

徘徊边缘 提交于 2019-12-13 04:58:16
问题 I dont understand why there is more than 1 process when I run run.php once from a browser In the PHP code, I have the following: run.php <?php shell_exec("php theprocess.php > /dev/null 2>&1 &"); ?> theprocess.php <?php $z = 1; while ($z <= 20) { echo $z . "\n"; $z++; sleep(3); } ?> I execute run.php from the browser (eg: http://localhost/run.php) Then I typed: ps aux | grep php username@ [~]# ps aux | grep php username 27272 0.0 1.5 89504 64468 ? R 17:33 0:00 php theprocess.php username

Is FILTER_VALIDATE_EMAIL sufficient to stop shell injection?

梦想的初衷 提交于 2019-12-13 02:19:29
问题 So I'm planning on using shell_exec() to handle running a php script that sends an email. It's all working great, but I was just slightly concerned about the security implications of only using FILTER_VALIDATE_EMAIL to ensure injection can't occur. So, for example, I will be using something simlilar to this: $email=$_POST['email']; if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo 'Nope ...'; } else { shell_exec("/usr/bin/php /var/www/mysite/includes/sendemail '" . $email . "'" > /dev

PHP shell_exec - how to terminate the process if the connection is closed?

萝らか妹 提交于 2019-12-13 01:16:09
问题 I have a working php script using shell_exec to execute an external program that take about 30 seconds to complete. Problem is that if an user close the browser or the connection is closed for some reason the program executed with shell_exec continue to run for nothing, since it's output can't be sent to the user anymore. Is there a way to kill this process as soon as the connection is closed? Thank you for your help. 回答1: Finally I've solved it! I've used the PHP function connection_aborted(

PHP shell_exec running a shellscript with ssh

落花浮王杯 提交于 2019-12-12 20:24:43
问题 I have a shellscript with connects to a a different machine with ssh and a key so it does not need the username and password. When i run this script from commandline it works fine.. but when I run this script from php shell_exec it does not work. If I make an ssh connection with PHP and run the script as my own user it does work. Now for my question :D Is there a way to just running the script in shell_exec from php without making an connection over ssh as a different user? 回答1: Did you

Problems executing Perl scripts from PHP

僤鯓⒐⒋嵵緔 提交于 2019-12-12 19:11:34
问题 Trying to figure this out. I am trying to execute a perl script within php, using shell_exec() like so: <?php $output=shell_exec("./tst.pl > test.txt"); //$output=shell_exec("./tst.pl"); echo $output; ?> It will not write output to a file using ">" filename.txt. It will work if I execute without directing it to a filename as I can confirm this with echo. Does this have to do with using ">"? Permissions should be fine as I am able to run the same perl script on command line and direct to file.

php shell exec hangs when using wkhtmltopdf

寵の児 提交于 2019-12-12 12:12:10
问题 I am trying to generate a PDF from HTML using PHP. I am running Mac OS X as my development environment although I would like this code to run on a production linux server. So far I have got: $url = escapeshellarg("http://www.google.com/"); $output = shell_exec("/usr/local/Cellar/wkhtmltopdf/0.11.0_rc1/bin/wkhtmltopdf " . $url . " /tmp/tmp_pdf.pdf 2>&1"); echo "<pre>$output</pre>"; This code does generate the PDF in the /tmp/tmp_pdf.pdf. The problem is it never does echo "<pre>$output</pre>";