Using Exec Function To Get A .exe Return Status Gives CGI Error
I'm trying to make a web page to work. It worked before so it has to
be something related with the configuration.
My problem is a call to a compiled executable (made for me) that
returns 1 or 0. It does not print any text to the standard ouput so
the error is strange:
CGI Error: The script can .. because of the HTTP headers (I have it in
spanish so the message is not the exact one).
As supposed, the HTTP headers are needed only if the executable prints
out a text to the browser but it's not the case. And (I repeat) It
worked as it before. The machine had to be formatted and the guy in
charge of that is not with me anymore.
View Complete Forum Thread with Replies
Related Forum Messages:
Return HTTP Status Code
I guess if it is possible to obtain a HTTP response code (200 or 404) without fopening entire remote page. www.example.com/a.php --> 200 THEN fopen() www.example.com/b.php --> 404 THEN die() I so would like to low overhead of server.
View Replies !
Warning: Ftp_exec() [function.ftp-exec]: SITE EXEC Is An Unknown Extension
This is kind of a part II to a question a posted earlier about exec and shell_exec not working. I'm trying to use ftp_exec to execute some simple command: $conn_id = ftp_connect("$server") or die ("Cannot initiate connection to host"); ftp_login($conn_id, "$username", "$userpass") or die("Cannot login"); $command = 'cd..' if (ftp_exec($conn_id, $command)) { echo "$command executed successfully"; } else { echo "could not execute $command"; } ftp_close($conn_id); I'm getting the following error: Warning: ftp_exec() [function.ftp-exec]: SITE EXEC is an unknown extension in /home/urieilam/public_html/work/video/test1.1.php on line 21 could not execute cd.. Have tried other commands as well, get the same. Could this be a security issue or something to do with p Safe Mode? I don't know much about commands, shell, etc..
View Replies !
Exec Gives Return Code 127
I'm trying to run this Code: exec($gpg_cmd,$return,$exit_code) and the command is Code: /usr/bin/gpg -a --no-tty --batch --yes --no-secmem-warning -o '/var/www/html/uploads/agla/new_leads 11-03-2006.csv.pgp' -r '***Key Goes Here***' -e '/var/www/html/uploads/agla/new_leads 11-03-2006.csv' it works fine from the command line. But ran from the script it returns 127, my apache installation is not chrooted, safe mode is not on, I turned off selinux, I even tried a symbolic link to the binaries in my cgi-bin directory, then changing the paths in my script. I've tried using system, and got the same problem.
View Replies !
Exec() Return Code 127
I'm having problem executing shell command as well as script using exec(), system(), or passthru(). It always return code 127, and even really simple script doesn't works : <?php exec("date",$date, $int); print 'date :'.$date[0]."return value " .$int."<br>"; ?> I tried to change the permission of the file, move the file, change the owner of the file without any sucess. My guess is that "php" doesn't have the right permission.
View Replies !
Warning: Exec() [function.exec]:
I'm using PHP Version 5.0.4 in IIS5, Window 2003. When I execute my script, it prompt me the following error : Warning: exec() [function.exec]: Unable to fork [ping 10.8.1.70] in c:Inetpubwwwrootswitch.php on line 62 Below is my script : <?php $line1 = exec("ping 10.8.1.70", $output); exit; ?>
View Replies !
How To Get Return Status Of "Save-As" Dialogue Box ?
I am displaying "Save-As" dialogue box header("Cache-Control: public, must-revalidate"); header("Pragma: hack"); header("Content-Type: " . $this->mime); header("Content-Length: " .(string)($fsize) ); header('Content-Disposition: attachment; filename="'.basename($this->path.$this->name).'"'); header("Content-Transfer-Encoding: binary "); using "header()" function. But how to know that user has clicked "save" button or "cancel" button.
View Replies !
CGIWrap Error: Exec Format Error
This message usually indicates there is a problem with the script itself. Often this indicates either that the #! line of the script is incorrect, or the script was uploaded in binary mode instead of ascii mode. Check to make sure that the script does not have control-M's at the end of every line. That will prevent it from executing. An easy fix that takes care of this most of the time is to put '#!/.../perl --' instead of '#!/.../perl' on the first line of the script. This is typically a problem if the script was edited or uploaded from a DOS/Windows/Macintosh station to a unix based server. If you are not the owner of this script, please forward this error and the URL that caused it to the script owner. That is often the component in the URL right after /cgiwrap/. does anybody know what does this message means?
View Replies !
Php Exec Error
i cannot execute the exec command and pass varaible through it exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" '); I have to execute it this way ... exec('/secure/sed_repl.sh "this one" "this one to" ');
View Replies !
Function/Global Var To Return Name Of Calling Function?
I'm sure I saw this somewhere but can't remember where and can't find it now... Is there a PHP function or global variable that will return name of the calling function? I want to do this for error reporting purposes without having to hardcode the function name into my scripts. Say the function is named getFunctionName(). I want to do something like... function foo() {
View Replies !
Exec Function
Iv tried using this exec function and iv never used it before today.. im not completely sure what it does. <?php $command = "/movie/Without a Paddle.avi"; echo exec($command); ?> I hoped that this script would open up a movie, but it doesnt. I am using this function completely wrong or is there a problem with my code?
View Replies !
Exec() Function
I'm having trouble getting the exec() function to work in my script. I have never worked with this function and before I contact my server admin I want to verify my code is correct. script_name.php is in the same directory as this script that is running exec(). Is this correct? exec("./script_name.php &");
View Replies !
Function Exec
I'm trying to execute a command with "exec" but it doesn't work. Here is my code : PHP Code: exec("../../blast/blastall -p blastn -d est.txt -i testseq.txt -o test.txt"); I'm sure that my scrypt reads this line but nothing happen. Does someone know how to use this function ?
View Replies !
PHP Exec Function No Output
I am running PHP 5.1.6 (cli) on Linux. When i use the exec($cmd, $output, $return) command the $output array is always blank if the command had an error in it. There are only values if the command was successful. How do I capture the error text returned?...
View Replies !
Php Exec() Function Is Not Working
I am trying to execute linux command with php. I am try to log on as super user, so I have used the following code: exec("su root"); exec("<password>"); But I dont think its working, becuase if I want to change my directory and view the list, I find myself in the same directory. I have used the following code: exec("cd /"); Passthru("ls -l");
View Replies !
Ssh2 Mod And Exec Function
Something very strangne happens with the function ssh2_exec, i can't read the stream answer after execution in the remote computer. I work with apache 1.3.30 and php 4.3.10 , libssh 2.0.5 . the ssh2 module looks to work correctly but sftp functions cause a big delay causing server timeout and ssh2_exec can't read the output. Tryed many things recommeded in php website and forums but always the first ssh2_exec reading success and the following ones fail. $stream=ssh2_exec($conn_id,'/usr/bin/ls ./public_html'); I tryed to read the output with: stream_set_blocking( $stream, true ); $cmd=fread( $stream, 4096 ); after while($line = fgets($stream)) { $cmd .= $line; } and while( !feof($stream) ) { $cmd .= fgets($stream) } Nothing success to catch the output for the second execute order. In the same process only the first exec could be read. Anybody know
View Replies !
Can Not Execute Exec Function In Php
I am facing a strange problem , in linux server system commands like exec, system are enabled but one particular command is not working properly , either its returning null or 127. Command is exec(whois -h whois.crsnic.net "bnbnmnmbnmn.com") But this command is working properly in another linux server. Any suggestion is well come excepting reinstall or re-configuration as its not possible . Commands like exec('whoami') are working . Server:linhost161.prod.mesa1.secureserver.net 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686
View Replies !
Using Exec() Function In PHP5
I have problem by using exec() function in PHP5, Apache and Windows XP to run an external program from my PHP page reside on server. When I call my program using exec() the page just stops (waiting for www.mysite.com...). I have used by absolute path and result was same. Also, I have tested my PHP page by running by using PHP (or PHP-cgi) interpreter in command line and it just works fine without any problem. I don't know why it doesn't work when I call it from my page. Can anybody help ? I think it is something wrong with Apache or PHP settings. Am I right ?
View Replies !
Exec() Function And Shell Scripts
I have a shell script written that basically grabs a selected .jpg or .png image file and wraps it as an .swf file for use in a dynamic Flash site. My question is this: What are the limitations of the exec() or system() commands? I can get them to work just fine with common linux commands(ie. ls -l, pwd, etc.), but it won't run these sort of commands: ./thisisascirptname or sh wrapper.sh I get no results with these and yet when I perform the same operation on the command line by hand, it works just fine. This is the script I'm using to test it, by the way. $lastline = exec("sh wrapper.sh", $all_output, $return_value); print("<b>Last Line:</b><br>$lastline <p> "); print("<b>All Output:</b><br> "); for($index = 0; $index < count($all_output); $index++) { print("$all_output[$index] <br> "); } print("<br><br> "); print("Return Value: $return_value<br> "); The "ls" and other similar functions all return properly. I can't figure this out and it's driving me nuts. Any help?
View Replies !
Problem Using System/exec Function.
I am faced with strange problem. Basically I want to make a script which would take mysql back up for me. I have come up with following. [ basically code is borrowed from some other place ] PHP Code:
View Replies !
Error Running Exec() To Kill A Process
Red Hat Linux 7.3, Apache 1.3, PHP 4.3.3 I am trying to create a PHP script to terminate a process that is running on the server. The file and folder permissions are set correctly, but I am getting the error "kill 943: Operation not permitted"; I am running the command "exec ("/bin/kill 943");".
View Replies !
Running An .exe File Using Exec() Or System(), Unable To Fork Error
I have a problem with running an .exe file using exec() or system() I have downloaded a file called ffmpeg.exe for converting movie clips. I can use the program thourg the command line in windows (cmd), but I'm not able to have PHP run the file. First PHP gave be an "unable to fork" error. But then I gave users access to the cmd.exe file and solved that problem. So now is no problem running for example exec("dir");
View Replies !
Return $$ From Function
How can I use the variables generated by the following function in my code? They're just not being passed to the main script. I've tried global $$k; bu that did nothing PHP Code:
View Replies !
To Return A Function?
If you guys have a function that doesnt return anything, do you still include a 'return;' statement at the end? Is it good practice todo so or pointless?
View Replies !
Function Return
I have created an image resize code into a function which saves me outputing the code four times as my form has four image inputs. Anyway at then end of this function I have an echo section that displays the image resized ( 4 in all images as function is called 4 times). Anyway I would like to return the image name after the function is run, but not sure how to get this info. Code:
View Replies !
What Is A Return In Function ?
I know this is a wage question, but since iam new to the programming world jsut wanted to clarrify this silly doubts. Why do we need return in the function when we can use echo and get the output? Can someone explain me more abt funtions ?
View Replies !
Function Return()
if you have return $varname; in a function call, how do you then use that variable? ex: function test() { $sql_query = 'select * from table' return $sql_query; } is it possible to return a query like this? basically i want the function to simply query the database based on passed info, and have the parsing be handled by the calling page.
View Replies !
Return Value From Function
i've got a function which insert data into database. so if the transaction is successful, return a value. after that redirect user to another page. here is code:
View Replies !
Is Return In Function A Must
I have something like this <? $array1 = array("dir1", "dir2", "dir3"); $array2 = array("file1", "file2", "file3"); //function to do the same function menu($haystack){ foreach ($haystack as $needle){ echo $var; } ?> I'm including that in my index and just echoing (echo menu($array1)) Now that function doesn't have return $var, and that worries me. Do functions always need to return something, or? Is there maybe a better way to do this, so that i output it with simple echo, but again keep function propertie?
View Replies !
Can't Use Function Return Value
getting this error: Fatal error: Can't use function return value in write context in C:Program Filesxampphtdocsentries.php on line 96 this is the code, starting at line 95: $tsid_rsDetails_total = "-1"; if (isset($_COOKIE('timesheetid'))) { $tsid_rsDetails_total = (get_magic_quotes_gpc()) ? $_COOKIE('timesheetid') : addslashes($_COOKIE('timesheetid')); } mysql_select_db($database_conn_org, $conn_org); $query_rsDetails_total = sprintf("SELECT timesheet_entries.id_timesheets_main, (Sum(timesheet_entries.hours) + Sum((timesheet_entries.minutes)/60)) AS "rTotal" FROM timesheet_entries WHERE id_timesheets_main = '%s' GROUP BY timesheet_entries.id_timesheets_main ", $tsid_rsDetails_total); $rsDetails_total = mysql_query($query_rsDetails_total, $conn_org) or die(mysql_error()); $row_rsDetails_total = mysql_fetch_assoc($rsDetails_total); $totalRows_rsDetails_total = mysql_num_rows($rsDetails_total); ?> any ideas?
View Replies !
Return In Function
function Adding($number) { $number = $number+5; return $number; } <br> $number = 5; $newnumber = Adding($number); <br> echo "$newnumber"; I was reading this tutorial but I never understood why and what return does.
View Replies !
Function Return Value
PHP Code: if(strlen($_POST["room"]) > 1 && strlen($_POST["month"]) >= 1 && strlen($_POST["year"]) = 4){ include_once("calendar.inc.php"); calendar($_POST["room"], $_POST["month"], $_POST["year"]); } i'm getting an error: Fatal error: Can't use function return value in write context in.
View Replies !
Return Link Error
PHP Code: <?php $home = "<a hr"+"ef="+"infernobb"+"."+"a-host"+"."+"info"+">"+"Home"+"<"+"/a>"; if(file_exists("enterform.php")){ echo "File Exist Lets Return $home "; } else { echo"Error 403 File is Missing Please ReCheck Line 2 "; } ?> Preview: http://infernobb.a-host.info/checkfile.php humm how can u make php read the HTML im gonna go back and recheck hutzilla but i making sure whats the problem here also might be different reasons.
View Replies !
Exec() Function Warning: Unable To Fork (Access Violation At 77F81B4D)
I am trying to execute a DOS command with the exec() function. All I get is fork errors or access errors, regardless of what file I try to execute. Example: <?php exec("sync.bat"); `sync.bat`;?> Warning: Unable to fork [sync.bat] in C:testexec.php on line 3 Warning: Unable to execute 'sync.bat' in C:testexec.php on line 4 PHP has encountered an Access Violation at 77F81B4D Id doesn't seem to matter what kind of file I try to execute, .exe, .bat or .com. Any ideas? Has ANYONE executed an external program under php/Windows?
View Replies !
How To Return An Image From A Function?
Currently i have a script that creates an array of data points. This array is then sent to a function to create a graph of the points in the array. My problem is this: If i use the script as a php script on its own it will create the graph and i can display it using <img src= blah.php>. However, i changed this so the graph script was a function but this outputs the jpeg code for the graph rather than the pic of the graph. i am putting this down to the fact that php cannot use embedded graphics (hence the reason i used <img src>). So, i know the code actually creates the graph but i cannot figure out how to return the image to the main script to display the graph. $pic = imagejpeg($image); return($pic); ie, create the pic and save it as a variable to be returned and then displayed...doesnt work! i have also tried returning $image and then using imagejpeg($image) in the main script...which obviously doesnt work either. I have tried a couple of other things as well but they were equally unsuccesful. I reckon all this is probably as clear as mud so if any clarification is needed please ask!!
View Replies !
Return Array From A Function..
I have a function which querys MySQL table i have implemented. I used to have it all in the html page however decided to make my code better and continue learning by writing this as a seperate function with parameters passed into it, and then calling the function from the html page. The issue here however is while the function works, when i want to display parts of the data at a later stage in html page it does not work. The code that fetches the values for displaying is in the function. While i am trying to display the info in the array inside the html page within tables. I presume its because my function does query and then does this $data = mysql_fetch_array( $sql ); //all inside the seperate function and then i have to return $data as a means of passing it into the HTML page when i call the function. Therefore when i am inside the html page there is actually a $data that exists?? That is what i have deduced as being the problem however i can seem to find out how to return this $data or catch it in the html page!
View Replies !
Problems With Function Return Value
[color=blue] > Help, I'm stuck! I've written the below function as part of my form data > filtering steps and for some reason It won't return the right value![/color] All of these lines: $filter[] = strpos('to:', $post); will add another array entry even if the function returns nothing, so your end test is always true. Recode.
View Replies !
Return Array From Function
I want a function that is able to return a array. But the php-manual says that you can’t. Ex. of what I want: function arrFunc() { $returarray = array(“some”,”arrray”,”stuff”); return($returarray);}
View Replies !
Using A Function To Return A Boolean
I am using a function in which I want to return a boolean and I want a variable set that I can use in the rest of the program. Returning a boolean isn't much of a problem, but how can I set a variable called "$error" that can be used in the whole program? Now I only can use the variable within the function, how can I solve this?
View Replies !
Can I Return Array With A Function ?
i try to build a fetch_col function i give in parameter the query result and the number of the col which i want to return i fill an array with result in the function but i don't know how i can return the array i try : Code:
View Replies !
SNMP Function Return
snmpget() - if no connection can be made to host a fatal error is encountered instead of returning false. How can I avoid this problem? i tried: snmpget(...) or die (message); // still fatal error instead of message output
View Replies !
Return Function Loop
I have a function that returns all the products with the same ItemId. So I will usually have more than 1 row. The problem is I want to display the info from row one different than the rest. basically after I display the first row of product info - I just want a list of the other product names below: like: <td colspan="2"><?php for($i=0; $i<$numPd;$i++) { extract($product[$i]); echo $Name ."<br />"; }?></td> but it complains that my array is now empty?? maybe because I already extracted it for the first product? Code:
View Replies !
|