Exec - Executing External Programs
I have problem with executing external programs...
The code:
system("/home/pkunzip /arch.zip /3");
Does not work properly (nothing doeing)...
The code:
system("dir /w");
Working very-very good
View Complete Forum Thread with Replies
Related Forum Messages:
Executing External Programs
I know all the different functions that allow me to execute an external progam, however I have come across and interesting problem that I need to fix if it is at all possible. Is there a way that I can use the php functions and execute an external program by some other user other then who ever owns the apache process?
View Replies !
ImageMagick And Executing External Programs
I have installed ImageMagick and GhostScript (Windows/IIS) and IM is working from the command line (specifically the convert command) so now I need to get it working in php. To that end I have the following code: <?php system("c:Program FilesImageMagick-6.3.4-Q16convert.exe c:InetpubwwwrootexpgraphicsimgMagick est_file.ai c:InetpubwwwrootexpgraphicsimgMagickAIC.png",$retvar); echo $retvar; // Now you can check the $retvar for errors ?> c:Program FilesImageMagick-6.3.4-Q16convert.exe - the root folder for IM, location of convert.exe c:InetpubwwwrootexpgraphicsimgMagick est_file.ai - the location of the target image to use for conversion c:InetpubwwwrootexpgraphicsimgMagickAIC.png - the location, name, and format for the converted image Using the above code, it does not create a new png image. Before I set the permissions for the Internet Guest Account user to "read & execute" for the cmd.exe file located at C:WINDOWSsystem32, $retvar was echoing a value of -1. Once I set the permissions on C:WINDOWSsystem32cmd.exe, $retvar is echoing a value of 1. In either case, the new graphic is NOT generated. Is there something wrong with my syntax?
View Replies !
Executing External Programs From PHP4 On Windows98 With Apache 1.3.14 For Win32
I did a search, and did not find anything specific on this topic, so here goes: Trying to create a webpage button or link that when pressed executes Win98's "dialer.exe" with a phonenumber as a passed parameter. From my understanding, the exec function in PHP seems to work best with Linux (correct me if I am wrong please!). Are there alternatives? The other bit of knowledge I have not been able to find (and really is outside this forum), is that dialer.exe is supposed to accept control from external programs, but I have yet to find docs or examples of such.
View Replies !
Executing Programs On A Server
i've written a c++ program that converts one file type to another via two arguments (the input and output filenames). i want to execute this on my server, using something like exec("myprogram.exe $arg1 $arg2"); but then I realized my server is linux, and my program was compiled for windows. so I uploaded the .cpp instead, and now i'm trying to compile it doing something like exec("gccp hello.cpp"); which returns an exit code 127... not really sure what that means. I'm guessing I probably don't have permission to be creating files on my server...is there anyway I can change this permissions or anything?
View Replies !
External Programs
I have just installed my first Linux distribution (SUSE 10.0). Everything is compiled as far as Apache, Mysql & PHP is concerned. But, I have this problem: I call system commands through PHP using system, shell_exec etc The thing is that PHP responds OK when it comes to 'ls' or 'grep' or 'wget', but, in another program, not UNIX-native, there is no response. I am sure that the program is set up in the PATH, because, if I open a terminal, I can call it from everywhere and it works fine.
View Replies !
Multiple External Programs
I have a php script which when executed calls an external program. The external program goes off and figures some things out and the output of the program is returned as as an array to the calling PHP program. Next a second external program is called and the process is repeated. This goes on for 4 external program calls. The arrays are then analyzed and the results are outputted. Since the 4 external programs are independent of each other but each takes 3 5 minutes to run, I would like to run them all at the same time and then, when they are all done, proceed with the rest of the analysis.
View Replies !
Problems With Executing Binaries With Exec()
I have problems with executing external programms in php with exec() and system(). When i am trying to execute some shell commands eg system('ls'), exec('whoami') there is no problem , with my binaries (the simplest hello world program in c++) - no problem. But programms, which i've installed(./configure make make install) before, don't work.' For example i've installed cvs. Code:
View Replies !
Including External Php File And Executing A Command
I have two different servers, and i need to call a php of server B from server A, so i did this: SERVER A: index.php has: include('http://server-b/file.php'); The content of file.php is: phpinfo(); ... but phpinfo() throws info about server B instead of its parent file SERVER A.
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 !
Executing Multiple Shell Commands Via One Exec()-call
I wrote a PHP shell script under Linux which puts all existing [E]PS-Files within a directory into a list and should then start a single Ghostview window for each file. Sounds simple, but it's not: The following code provides for about half of the functionality I wanted: ==============code starts $bla = array(); foreach ($filelist as $file) { $bla[] = fopen("./trash/".$file.".tmp", "w"); exec ("gv ".$file." &", $bla); } ===============code ends Here, all files are opened one after another. The next file opens only after closing the current one. Actually I don't know whether the redirection of the output towards .tmp-files complies with the intended purpose of the redirection. The PHP manual states that when starting programs in background, the output would have to be redirected to a stream or file, otherwise PHP would continue to run until the respective program is terminated (which I really wouldn't care about at all, if it did so...). Then I thought about writing the line I would type manually for opening all ps-files ('gv bla1.ps & ; gv bla2.ps&; ...') into a string and then executing that string: ===============code starts $command=""; $bla = fopen("./trash/tmp", "w"); foreach ($filelist as $i => $file) { if ($i < count($filelist) - 1) { $command = $command."gv $file & ; "; } else { $command = $command."gv $file &"; } } exec ($command, $bla); ===============code ends sadly I get an error message from the shell: ================ error message starts sh: -c: line 1: syntax error near unexpected token `;' sh: -c: line 1: `gv uges_Boden.ps & ; gv ux_Boden.ps & ; gv uy_Boden.ps &' ================ error message ends
View Replies !
Exec And Shell_exec Not Executing Batch File Properly
I am running Apache and PHP on windows XP. Latest versions of them all. I am trying to execute a simple .bat batch file that simply copies 4 files from one location to the batch files location. The php exec command runs like this: V:Corehtdocswp ransfer.bat Y:folder here the batch file is executed and the command following is thrown into the batch file to specify where the files that need to be copied are. The Y: directory is in windows considered to be a network drive, although it is really just a folder on the same machine, i did this because there are spaces in the folder names on its way to where I need the information copied from i.e. "Program Files" When I run this in the command prompt by entering this in manually it runs perfectly. However when running exec in the PHP script nothing happens; when I run shell_exec it gives me the output and it shows that every line in the batch file is executed however it does not actually copy anything. Looking into my apache error log I see that this is related: "The system cannot find the drive specified." Now what I am wondering is, how is it that I can run this script manually but apache tells me I cannot. My permissions are set to allow all and deny nothing since it is a machine well tucked into a safe place. Apache resides on the machine in C: eactorcore and it also setup a virtual drive as v:core. Trying both does not work.
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 !
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 !
PHP Programs ?
Im after a php program which is of the likes of textpad but designed for PHP so it checks curly braces and other simple errors in PHP code to us PHP novices out ?? Is there anything on the internet like this, download links (the best few)?
View Replies !
PHP Calling Programs On AS/400
I have a website (running on a linux machine) that currently makes use of JSP to access data on an AS/400. I've found information telling me that after setting up ODBC drivers on the linux server I'll be able to access the databases on the AS/400 however I've not found any information about executing programs on the AS/400. I've looked at the docs for exec, passthru, etc. and it appears those will only work on the local operating system. Is it possible for a PHP page to execute a program on a remote machine? If so, how does PHP handle the ASCII <--> EBCDIC conversion for parameters passed and returned?
View Replies !
Test The Same Programs
I'm building my php scripts in one computer and i don't have any problem, but when I test the same programs in other (win xp ie) don't work at all, specially whe you do submit. I tried testing with this simple script: <?php if($_POST["test"]){ print "test ok"; print $testa; } ?> <HTML> <HEAD> </HEAD> <BODY> <form action="<?$_SERVER['PHP_SELF']?>" method="post" name="forma" enctype="multipart/form-data"> <input type="submit" name="test" value="submit"> <input type="text" name="texta" size="20"> </form> </BODY> </HTML> When you submit the form, print "test ok", but no the value of $testa variable. I use this way to send data and always works. (wamp5). I checked the services wampapache and wampmysqld and both are working then i tried printing phpinfo() and it works too.
View Replies !
Compiled Php Programs
Is it possible to compile php source to create a binary? I am thinking along the lines of building an application for folks, but do not want them to have access to the source code. I like php and perl, but am not sure if there is a way to "secure" my programs if I use them.
View Replies !
Auditing Programs?
I'm trying to perform an audit on a PHP script and am curious what kind of software there already exists to do such things. I think the ideal solution would be something that, for each variable, provided a list of the functions that variable was passed through. Code:
View Replies !
Running Programs
I've just installed apache and php. Both installations passed the test (I get that chart of info that PHP displays if your installation is OK). Here's the problem: whatever I save with a .php simply does not work I'm talking about the World" programs that I simply paste and save, not something I wrote. I've been saving in c:/program files/apache software fundation/apache2.2/htdocs.
View Replies !
POST Variables From Programs
we are trying to make a program in C++ that will comminicate with a PHP script. But we dont know how to get the variables from the program. We got it figured out with perl/CGI, but PHP seems to be a better way to connect to SQL server. On PHP the GET works, its easy, but it's not secure enough. I need informtion on what headers does the PHP require to get the POSTed data from a program.
View Replies !
Different PHP Programs - 1 Registered User Possible For All?
I am new to php and I have three php softwares that I want to install on one website. I'm wondering if a person registers for one, is it possible that he can access the other softwares also? Otherwise that person will have to register three different times for the same website to access all the resources. If it is possible, will I have to change anything?
View Replies !
Running Console Programs
Does console programs free memory during the execution ? Until now i thought that a script never releases memory until the end is reached. But now i found the term GC a few times while reading about Zend Engine 2. Also the PHP-GTK page mentions that there is no memory deallocation. But how can one write a GUI program without memory control?
View Replies !
How To Make Programs Run Fast
I made a PHP Program that generates report. my only problem is it generates report for more than 30 mins when I try to access 150 employees and calculate its DTR. Can anyone of you recommend me how too make my program run fast? Is there any code / program that I must use?
View Replies !
Submit Standalone Programs With Php
I'm building an application which submits scheduled php jobs. The way I would like it to work is to have one php program to submit the other php programs on a scheduled basis. This control program shouldn't have to wait until one job finishes before it can start the next one; instead, it should be able to submit all the jobs in one go, but it also needs to be able to be informed of the return codes of the submitted programs so dependent programs can be submitted too. I've looked at the exec() and system() commands, but they either don't seem to allow return codes to be returned from a submitted program to the submitter program or they unconditionally print anything the submitted programs produce.
View Replies !
Blocking 3rd Party Programs
a script in php or another language which lets you block any illegal 3rd party scripts/programs? Such as rsclient.exe is a auto-clicker which clicks a button automaticly for how ever long you want it to do it in seconds. Of course it usually comes with a virus anyways but people use it. I need a script that stops any program or script to access the website scripts.
View Replies !
Sparse - New Framework For MySQL Programs
I believe I posted this once before, but enough has changed that I'm doing it again. 8-) I have been working on a project called Sparse, a framework specifically for creating PHP/MySQL programs. It is designed with usability in mind - it is meant to be as easy to use as possible. Essentially, the majority of the backend is already done for you, and you can design and configure your website using a few extra HTML tags. It's also very flexible - you can easily integrate it with regular PHP code right in the file. The new version also prints out every form in degradable Ajax, meaning that those users without Javascript ability will use the regular functionality. The end result is far less code, meaning less development and maintenance time, fewer errors, and more ease in changing things around.
View Replies !
Coding A Page To Allow Running/restarting Of Programs?
WOuld it be possible to code a php page to allow running/restarting of programs? Im trying to find a way toallow users with access tot he page the ability to START or RESTART crashed programs. These program present NULL security risk So this is why im asking. With this I wouldlike th epage to First ask for authentication before proceeding to the start/restart page. WHich I'd like to be *NIX based instead of usual php password stuff.
View Replies !
Scalability Of Perl Cgi Programs That Load Text Files
Suppose you have a perl program that is called by a web page to generate another web page. The program is written to load data from a text file on the server and make certain substitutions in the loaded text prior to the output of html. If one user is on the site, it should not be a problem. If many users try to access it nearly simultaneously, will it be a problem? example:
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 Not Executing, IIS 6
I'm attempting to run PHP on Microsoft IIS 6.0, and the PHP will not execute. For Example: test.php: <? phpinfo(); ?> When I request http://localhost/test.php I get a blank page. When I view the source, I get: <? phpinfo(); ?> Any ideas what I am doing wrong? Any resources that could guide me through the install process? The .php extensions are setup correctly (I believe) in IIS.
View Replies !
PHP Executing Twice
I am facing very strange problem When I submit any form using 'POST' method. my script executes twice. Is this a PHP bug or some thing else. I am using PHP4.3.1, MySQL 4.0.1, Apache2.x.x in Windows 2000 professional.
View Replies !
Executing JSP In PHP
I have a form processing script in php which submits data to email and a database, that works fine. However before it does that i need to create a secure hash from a jsp file. Im at a loss as to how to do this. Would the best bet be to use SOAP or similar, and if so would anyone be able to give me any pointers, i haven't indulged in web services as yet.
View Replies !
Executing Js From Php
I'm using CURL to navigate to pages on another website. There are links on the website which I need to navigate to that are created by submitting javascript, ie: <a href="javascript:blah">. Is it possible to use curl to execute these links and return the resulting page?
View Replies !
Not Executing (sometimes)
I run a message board site that has been having technical problems lately. Today I upgraded my version of php via an apache build in cpanel (now on php 5.0.x - but that doesn't seem to matter). When I access .php files that don't rely on a database, they run. However, all the .php files that use my MySQL database don't execute and prompt my browser to download. I should mention that I tried to upgrade MySQL today too. I was using 4.0 and upgraded to 4.1.
View Replies !
Executing An SSI Within A Php File.
I have the following line in an old shtml file: <img src="http://www.domain.com/cgi-bin/logtrack/log.pl?ref=<!--#echo var="HTTP_REFERER"-->" width=1 height=1 border=0> What this does is execute log.pl with the refererer to increment a logtracking program and find out what their referer is. How would I go about porting this to php?
View Replies !
Executing Scripts...
How do I execute one .php3 script from another. Passing one or two arguments, and then receiving the output? I have tried using the exec and passthru function, with no luck.
View Replies !
Executing Chunk Of SQL
I'm attempting to write an install script, I'm using the ADODB abstraction layer with my script, with that said here is my problem. I've got a large chunk of SQL that I need to execute through PHP, so I put it in a variable like so: $db_sql = " DROP TABLE IF EXISTS im_categories; CREATE TABLE im_categories ( id tinyint(11) NOT NULL auto_increment, name varchar(100) NOT NULL, type varchar(100) NOT NULL, template varchar(200) NOT NULL default 'default', PRIMARY KEY (id) ) TYPE=MyISAM;"; Then I try to execute it using: $result = $db->Execute($db_sql) or die(vpError() . $db->ErrorMsg()); I get the following error every single time and I have no idea what is causing it, the SQL data is from a phpMyAdmin export by the way. PHP Code:
View Replies !
Ajax Not Executing Php
When a user clicks a link I have it open up a file in a div using ajax. my code is <a href="#Find" onclick="javascript:jah('Find.html','content');">Find</a><br /> Where Find.html is an html file on the server. Now when I do this everything works fine except php code is not being executed. The jah code is function jah(url,target) { // native XMLHttpRequest object document.getElementById(target).innerHTML = 'sending...' if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = function() {jahDone(target);}; req.open("GET", url, true); req.send(null); // IE/Windows ActiveX version } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = function() {jahDone(target);}; req.open("GET", url, true); req.send(); } } } function jahDone(target) { // only if req is "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { results = req.responseText; document.getElementById(target).innerHTML = results; } else { document.getElementById(target).innerHTML="jah error: " + req.statusText; } } }
View Replies !
Executing Applicaitons
is there any way to execute desktop applications under a web interface using php? I need to get a non-finite amount of users to be able to execute a learning course program and use it remotely using a web interface.
View Replies !
Executing A .bat File With PHP
I have a .bat file that copies certain files across a network and I needed a way to run this file using PHP. I was looking at exec() but I was not sure exactly how to use it. I was also using pstools but could not get them to work with PHP. Can someone give me an example of how to do this or send me somewhere where I can read up on this?
View Replies !
Executing A Variable?
If a variable stores a function, could I execute the function by typing the variable alone? Or maybe by echoing it? <?php /* Set variable */ $math = round(23.89); /* Execute variable? */ $math; /* Echo variable? */ echo $math; ?>
View Replies !
Executing A Program
I am trying to run a console application which needs to keep running even after the php script has finished executing. I also need the PID or some sort of handle I can use to kill the program at a later stage.
View Replies !
|