Exec A Commandline Program
I made a topic about this before, but got one post helping, and nothing more, even though the post did not solve the problem. I need help uploading a file and sending it to a commandline windows executable. The program is called nconvert.exe, I will be uploading dds textures and converting them to bmp pictures, then immediately offering them back for download, not storing them on the server. The command to convert a file is this: nconvert -out bmp %1 %1 being the file passed to the executable.Â
View Complete Forum Thread with Replies
Related Forum Messages:
Cannot Get The Program To Run At All Through Exec
I downloaded the program called Snapshotter which allows you to take screenshots of webpages through the command-line. Server is Win2k3/XP (live/local). I cannot get the program to run at all through exec while the same directory/permissions for ffmpeg run fine. I cannot even get it to spit out the default output you get if you run it without arguments. exec("dir") works fine, but exec("c:lahSnapshotter") doesnt return anything. Registered the path in the PATH environment and still no luck, yet exec("c:lahffmpeg") works fine and returns data.
View Replies !
Exec Wont Run A Cpp Program
I'm trying to get Zonminder up and running on FC4 One of the asso programs is zmu.cpp - compiles fine. And runs from the command line IE. /u/l/b/zmu -help returns Usage. zmu -m 2 -z (real cmd) from cmd line does what it should do. However (in xx.php) exec ("/usr/local/bin/zmu -m 2 -z", $ret); doesn't. From what I can tell it doesn't even enter the program. Permissions are 755. If I change the exec to ("ls") - works, date - works. I've compared "env" - nada. SafeMode = Off. Is there ?anything? else that might cause my problem?
View Replies !
Exec() Call To External Program
We are trying to use the exec() or system() calls in a php script. The program we are trying to call takes 1 parameter in the form of: email@domain.com[usercode] There are no spaces in the parameter at all and we have tried placing quotes around just to see if it mattered. We have also modified the parameter just to send it hello. Here is what we get: With no parameters the php script executes the program where it displays the error message from the program stating that not enough parameters were supplied. We then add the word "hello" to the end after a space so the command looks like this: command "hello" and the program no longer executes at all. No matter what we do, if we supply an argument to the command the php code will not execute the program.
View Replies !
Php Exec To C Program That Writes File
I'm trying to use the exec() call in php to run a program that I've written and compiled from C. This program attempts to create a new file and write data into it. If I simply run the program from the shell, it writes the file no problem. If i run the program through an exec call in a php script, however, the program executes but it seems to not have the correct permissions to be able to write the file.
View Replies !
Use Exec To Run The Program Directly From The Server.
I have an image manipulation program that is run from commandline, I have never used exec before and I'm scared to becuase I don't want to mess up my server or anything. Basically, I want people to be able to upload an image, then arrange for some manipulations to take place on the file in a temporary batch file, then use exec to run the program directly from the server. The program is called nconvert.exe, and the main thing I want to do is convert DDS textures into BMP files, the command, from Windows "cmd" is: nconvert -out bmp %1 %1 being the dds file to be manipulated. How would I go about doing the exec part? I know how to do the upload, but not the exec.
View Replies !
Exec Command Executing The Program In The Background
i am running xampp on my computer from apachefriends.org, it's a apache server this is the php script <html> <head> <?php exec ('notepad'); ?> </head> </html> but when i execute the php script on my computer , notepad doesnt not run i used a process viewer and discovered that notepad is running in the background and i cannot see it does anyone know how NOT to make it run in the background? i wan to see the notepad window on the apache server (my computer)
View Replies !
Securing Data Between PHP Script And Exec'd Compiled 'C' Program
I'm using RSA Securid Tokens, and I'm going to write a little 'C' program that takes as input the userid (i.e. "jsmith") and the number displayed on the token (i.e. "123456") and returns a result code indicating whether authentication is successful. The compiled 'C' program will be called from a PHP script. I know that if I pass the parameters on the command line, i.e. authenticator jsmith 123456 the parameters are world-visible (via "ps -Af", for example) and this is an information leak. <BEGIN QUESTION> How can I pass things securely between the PHP script and the exec'd program? <END QUESTION> One way I suppose I could always use is to create a file from the PHP script and then just pass the filename to the program (assuming permissions and UID/GID were all set up correctly). But is there a more elegant way that doesn't create files, such as pipes or shared memory?
View Replies !
Parameters And Commandline
i want to start a php programm from commandline and pass some parameters to the programm. but the programm did not recognize the parameters. the commandline ist: php liste.php para1=one para2=two the source (list.php) .... echo $_request[para1]; echo $_request[para2]; .... why does this not work?
View Replies !
Interactive Commandline, Is This Possible?
You know those little interactive commandline scripts in linux where you got a menu 1,2,3,etc. Well I have got one in php where you can do this, but my question is: Is it possible to load another interactive commandline(ie. iptraf) when you press 1 .. You'll have to somehow exit the current one and enter another.
View Replies !
PHP Commandline Script Without Commandbox?
I wrote a php script which functions as a plugin for a Windows application. The Windows application simply calls the php script at certain triggers. This all works fine, except that every time the php script is called a commandbox is shown. The command is like this: php.exe -q script.php Is it possible to have the php script do its job without showing the commandbox?
View Replies !
Pasing Part Of An URL To Commandline
I have an URL like this http://system/web/htdocs/graphthis....ess&monitor=aaa I would like to call now the command line php like this: php graphthis.php '?csv=/tmp/data.cvs&dir=/web/htdocs/stress&monitor=aaa' The question is can php translate this parameter string into the $_GET[] aray somehow, so I don't have to rewrite the script ?
View Replies !
Php/curl Works From Commandline, Not Browser?
While trying to learn the ins and outs of the php CURL library, I decided to write a php script that posts a form on the Chicago Board of Options (CBOE) web site, which returns an ASCII text file. CBOE appears to keep your form query data in cookies, so this seemed like a good use of curl. Well, my script works just fine when run from the commandline. When accessed from my browser, it returns an empty string where the data should be. I have no idea why. Here is my script. Below it I will add further comments. ========== begin script optionchain.php ========== <?php // cookie and error log path - SET THIS BEFORE TESTING define(TMPFILEPATH, "/mf/home/unicorn/shell/tmp"); /* * This script gets option chain data in a comma-delimited text file * from the Chicago Board of Options web site www.cboe.com. * * Example for Microsoft (MSFT) stock options: * * URL syntax: http://example.com/optionchain.php?ticker=MSFT * * Commandline: % php optionchain.php MSFT */ $tickersymbol = isset($_GET['ticker']) ? $_GET['ticker'] : $_SERVER['argv'][1]; // get argument from commandline if no $_GET $ch = curl_init(); // initialize curl curl_setopt($ch, CURLOPT_VERBOSE, true); // verbose errors $er = fopen(TMPFILEPATH.'/curl_err.txt', 'w'); // error log file curl_setopt($ch, CURLOPT_STDERR, $er); // log the errors curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_COOKIEJAR, TMPFILEPATH.'/cboe_cookie.txt'); curl_setopt($ch, CURLOPT_REFERER, 'http://www.cboe.com/delayedQuote/QuoteTableDownload.aspx'); curl_setopt($ch, CURLOPT_URL, 'http://www.cboe.com/delayedQuote/QuoteTableDownload.aspx'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); // "log in" to web site by accessing first page (sets cookie) $discard = curl_exec($ch); // now post the form. The result will come after setting more // cookies and receiving a redirect to a different URL, // http://www.cboe.com/delayedQuote/QuoteData.dat // which returns data using the query data contained in a cookie. // AFTER that we get redirected back to the original page, // so limit redirects to 1 curl_setopt($ch, CURLOPT_MAXREDIRS, 1); curl_setopt($ch, CURLOPT_POST, true); // enable HTTP POST curl_setopt($ch, CURLOPT_POSTFIELDS, '__EVENTTARGET=' .'&__EVENTARGUMENT=' .'&__VIEWSTATE='.urlencode('dDwtODQ5MjIyNjc7Oz5rmegY+ 4O27l7uWcpGd4iU+1RpAA==') .'&ucHeader:ucCBOEHeaderLinks:ucCBOEHeaderSearch:sear chtext=' .'&ucHeader:ucCBOEHeaderLinks:ucCBOEHeaderSearch:Butt on1=Search' .'&ucQuoteTableDownloadCtl:txtTicker='.$tickersymbol .'&ucQuoteTableDownloadCtl:cmdSubmit=Download'); // Get data (RETURNS NULL FROM BROWSER, WORKS FROM COMMANDLINE ??) $content = curl_exec($ch); // Close resources curl_close ($ch); fclose($er); // display result print "<pre>Data: {$content} End</pre> "; ?>
View Replies !
Scandinavian Letters + Commandline (Windows)
My script is run from commandline and it takes input from Word document (more exactly: Opens Word, saves file as HTML-document and then opens it inside the script). Then it parses it. If I issue print after getting data, I will see chars like ├ñ (ä). However, if I redirect the output on text file, I see chars like they should be. Next step the script does is making a pdf file. PDF file shows ä (ä) then. So I probrally need to change encoding somehow. Any help is appricated. PDF library: FPDF 1.53 PHP version: PHP 5.0.4 (cgi-fcgi) (built: Mar 31 2005 02:45:43)
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 !
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 !
Sessions? External Program / External Program
I am trying ac ouple of days now to learn some things on SESSIONS,but I think I am not getting it very clearly. I have a PHP page tha contains a form. Users enter data in the form, which are then written in a file (the file is created at the time a user enters some data) The file is then given as an input to an external program The external program runs and gives some results which are then stored in another file (that is created when the external program finishes) What I want to do is to somehow create these files and, when the user exits from the browser, then both files that refer to this user, will be deleted. Code:
View Replies !
PHP Used As A CGI Program
Manual for odbc_pconnect states: "Persistent connections have no effect if PHP is used as a CGI program." As I have just installed PHP on a PC with an Apache server, how does one tell if it is used as a CGI program, and if so, how does one confiure it not to be?
View Replies !
C Program And PHP
I have written this function in a C program, using Visual Studio. The PHP script executes fine, but the output is not displayed. I have been racking my brains for hours trying to figure this one out. The output from the php program should print to a file called 'out.txt'. The file is successfully created, but with no content. I am pretty sure it's the way PHP returns the results. Does anyone have any ideas? Any help would be most appreciated. int passCode(void) { FILE *phpFile, *out; size_t len; char buffer[1000]; phpFile = popen("php -f testing1.php", "r"); if (phpFile) { out = fopen("out.txt", "w"); len = fread(buffer, 1, sizeof(buffer), phpFile); fprintf(out, buffer); fclose(out); pclose(phpFile); return 1; } else { return 0; } }
View Replies !
How To Use ? And : In A Program
in the program below, what is the meaning/use of the question mark (?gcd) and the colon (:$a) after the return statement? <? $x=32; $y=80; function gcd($a, $b) { return ($b>0)?gcd($b,$a%$b):$a;} $val=gcd($x, $y); print "The greatest common denominator of $x and $y is $val"; ?> This recursive program is used to find the greatest common denominator of 2 numbers.
View Replies !
How To Program OOP
I use OOP for a PHP Application Framework I am programming. I have one base class which includes all the necessary functions and variables which all the other classes use. So what I originally did was that I made an instance of the base class and passed it to the other classes. Now someone insisted that this is not the way to do it. so I used 'extends base' to make the base class available to the other classes. Afterwards it worked fine, but it didn't make the code smaller nor did it result in faster speed. I used the benchmarking script from PEAR. So I wonder whats the difference between those two solutions, both work fine. Are there some tools to analyse how much memory a script uses?
View Replies !
Run A Program.
I am using system('GPA.exe ' . $filename); to run a program GPA.exe this program do the following things. ../GPA.exe filename.txt and will generate another file. HOWEVER, the problem is, there is no new file generated and I doesn't get an exception. I don't know why. Can somebody give me a clue?
View Replies !
Sig Program
I ran across a very cool little program today that I think I can reproduce for something I need on my site using PHP. http://www.danasoft.com/customsig.php How do they give the URL a .jpg extension and still be able to have it run a PHP script and send a JPG back to the browser?
View Replies !
Non-PHP-program To PHP/cgi
I read a POST-request from a Web-client over a socket and will pass this request to a PHP/cgi-Modul, to get PHP's generated HTML-stream. The request contains formular parameter and the data from an uploaded file. I copy the parameter-names and the values and pass them to PHP. This works fine, but I don't know how to tell PHP, it may read the data from the uploaded file.
View Replies !
PHP Program
I have a client that pretty much needs an admin program for their site. They are a local radio station. They want to be able to create forms within their website admin so they don't have to copy and paste code. They have no programming experience. NONE. They also want to be able to access their database to view content submitted. They send out birthday e-cards and all that junk. So does anyone know of a program that can do this? They have a thing like this in iHTML, but it's gettin spammed all to hell and they want a more secure route.
View Replies !
Exec();
well i know that exec("ndc reload"); would perform that command.. but i want too print out on the page what the command tells when i do like this: [root@xermin cryzeck]# ndc reload Reload initiated. [root@xermin cryzeck]# i want to print that Reload initiated. on the page.. how? not just echo("reload initiated"); but the stuff the command tells.
View Replies !
Using Exec()
I'm trying to use the exec() function to call shell scripts that in turn startup various programs under linux.. for example, when someone clicks on a link to restart a particular daemon, the daemon will then simply executed, either through the standalone command of /location/daemon or through the calling of a shell script that essentially performs an identical task. My problem is that exec() seems to only work through the user "nobody," which the Apache web server is running under. The scripts and programs I'd like to execute are under a user account named "admin." I've even tried chmod'ing all pertinent files w/ permissions that "nobody" could use to successfully access all necessary commands, without success, as the programs seem to crash whenever I do this.
View Replies !
PHP And Exec(dir)
I have been using opendir and scandir, but I want to try something else. Idea: using dir, and a) getting the result b) saving it as a file. As I have problems with executing files directly, it create a bat file and executes that. I can execute command, but by some reason I dont get any response (it should return something, and I get "") The missing response is why I create a file. I create the file on the network ( serversomewhere ) like this dir "serversomewherefilesdir" >"serversomewhere esult.txt" Here is the odd thing: dir cannot read from the network - the bat file is created there, it creates the result.txt file, but emtpy as it cannot read from the network. Reading from c: and it works.
View Replies !
Php Exec();
i've been trying to create a php script that writes some text to a file, then runs the perl interpreter on the file and shows the output. it works ok when valid perl is written to the file, so if i use 'print "hello world";' then it outputs 'hello world'. the problem is, if i enter invalid perl code, such as 'blahblahblah;', it outputs nothing. i'd like the php script to be able to get the error/output. does anyone know of a way to do this?
View Replies !
Exec(); & Php As CGI...
I have had to do some work on a RAQ server with php as cgi. The script I have written uses the exec(); function to run pgp to encrypt a file. Weird thing is this: The script does everything it's supposed to but I get the RAQ internal server error message. Should I be using passthru of something else in this environment? Forgive me I am a relative virgin as far as RAQs and php as cgi goes.
View Replies !
Exec Php
I have a php site. Some page needs to call an external program. The programs are home made c# applications. It uses to work without problem. For a while. Maybe it work for some hour. Or for a day. Or even for a week. At a certain point, when a php script calls the exe file, the application freezes. The following happens:...
View Replies !
Exec()
I am making a simple php script using exec() to execute commands in my linux host. When i execute 'ls' it shows the right content on that directory, but what i want to know if there is a way i can distinguish between folders and files. In this way i can lets say make folders show in black and files in grey. Also when i execute a wrong command i wanna get any system error message. Code:
View Replies !
Exec A .exe
I want to exec dos then within dos exec another.exe then write to that program with database varables or session's but how? how do you write to the last.exe program to give it it's command? <?php exec("C:/WINDOWS/system32/cmd.exe/program.exe"); ?>
View Replies !
Use Of The Exec()
<?php f($_POST['startup']){ if(!$online){ //$A1 = array(); //exec($servpath."khyller-server.exe") or die("<BR>Server Startup MSG - <Font color=red>Cannot find Server</font>"); //proc_open("call C:Serverlanked eleasekhyller-server.exe", $A1,$A2,$A3); } } ?> I'm first trying to get them to work at all just do something first. but with no success. I even sued or die and all I get is die D: Is it impossible or am I just dumb? I know I did this one, But I don't know how. Edit to add php color. my eyes were hurting in blackness.
View Replies !
Using EXEC
I've got a page on an application form that runs an executable. I don't return anything from the executable, and I don't want to the script to wait for it before continuing. I just want it to call the executable and forget about it. The executable is self contained, in doesn't return anything back to the script. I'm currently executing with EXEC like so: Code: exec("c:filename.exe " . $_SESSION['memberId']);
View Replies !
Exec() And Zip
I have zip.exe in my PATH on a windows XP box. Additionally, I have a script which, if I execute locally with php myfile.php. it runs fine. However, when I call myfile.php remotely with a web browser, it canot seem to find zip.exe. Below are the releveant code snippets. exec( "zip -mj ackups empcookbook.zip ackups empcookbook.sql 2>&1", $output, $res ); if( $res 0 ) { error( true,"COMPRESSION FAILED ".implode( " ", $output)); COMPRESSION FAILED The system cannot execute the specified program.
View Replies !
SU And Exec
I have a PHP CLI script setup in crom which runs as a specific user each night so that it has the correct security level. I want to also be able to execute this script "on demand" via a webpage. Is there a simple way to get PHP to execute this command as another user? How could I "SU script_user >>> runme.php" ?
View Replies !
About Exec()
I have a small custom 404 page in PHP. When this page is triggered I'd like some information about the requesting client, including its reverse IP. I would like the 404 page to be returned to the client's browser immediately, after invoking another function or script that takes care of the lookup & email duties. The 404 page doesn't care about the return value of the second script at all, it's fine if it fails. It looked to me like exec() is appropriate here, is that correct? Am I thinking about it wrong?
View Replies !
Exec ()
i want to add new Linux user in my system: exec ("useradd ........"); is not working . there is no error . but user is not getting added. Am i using the command in wrong way. is ther any alternative.
View Replies !
Is There A Way To Optimize My Program?
My Program is about parsing website through their url, My program is working properly but everytime it enters URL with so many sub URL (i mean thousand) my program seem to stop responding. Can you suggest something to this problem. somebody told me that i use the sleep() fucntion to not force my script to run successively, to give a pause to my program. Any thing more you can suggest? i'm not after the speed of execution but what im after is that he finish his job no matter how much time it takes....
View Replies !
Run Program Automatically
I want to create the option for my clients to create their own e-mail address. When I do this in Telnet, I have to run the command 'vadduser' It then asks me for a username, I want to assign this automatically. (1,2,3,4 etc etc) It then asks me for a password, I want this to be something the user has already given in a form (before the script was run). It then has to be retyped. Those two things can be done automatically. It then asks if I want to assign a disk quota (YES) and then asks for the number of megabytes (1) That's it. Are there any examples available of how to do this?
View Replies !
Php Email Program
Does anyone know of a php or even cold fusion based script out there for accessing email that can be customized? Right now I use SquirrelMail which is great, however, you can't really customize it to tie in with your web site. Is there something out there that is very flexible that I could make fit right into my site which is pretty reliable in terms of web email?
View Replies !
Should I Use A One Php Program Or Multiple
I have taken over a php web site. Once you login you are given six menu choices. Each option is or can be independant of the others. They each modify the same database but in different ways. On clicking the menu buttons the program calls php functions to do the action. Thus the user stays inside a large program. I was expecting the menu to provide links rather than function calls. 1) Is there a reason to stay inside a large program through function calls rather than linking to separate pages? 2) Am I correct that providing a <a href=... link would isolate the functionality and call a new program? The current program is spagettii code and somewhat buggy. There are side effects that depend on what function was called before. I am hoping that passing the hidden input parameters is all the connectivity I need.
View Replies !
|