Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




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 Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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?

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.

Executing MDL Programs Using PHP
Help to execute MDL Applications by making a call "mdl load <application name>" through PHP.

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?

Executing Large Sclae Programs In Fortran Using PHP
I have some large scale programs in fortran in server and i would like
to execute them by giving input through HTML/PHP forms.Iam trying with
shell_execute... Is there any other approach to execute the programs
(fortran,matlab,'C' etc) in server using PHP.

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?

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.

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?

Running Php Programs On Apache Server
I am using Apache web server and i am trying to run php programs over it My problem is that the php programs aren't running at all. Instead i am receiving messages "BAD REQUEST ERROR 400".

Php Function To Implement C Language Programs
I want to know of a function in PHP that will allow me to run C language code. I am using a C library, for that I need to write C code. So how can I incorporate C code in a PHP program.

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:

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.

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.

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?

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.

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:

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;
}
}
}

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.

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?

Executing .sql File
how may I execute .sql file using php?

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;

?>

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.

Auto Executing PHP Code
Right now i am on a matrimonial site. i wanna do an auto match finder. ie; there may be many registrations in the site. i wanna findout all those matched profiles on a daily basis, say by 12 midnight each day. i wanna get that list as a mail even if i didn't checked the admin screens. ie; the script should execute on 12 midnight each day automatically. is there any way. can i do it using PHP.

Executing Cgi Scripts Within A PHP Document
Is there a way to execute a CGI script using an include like I do with the SSI includes. I want to just execute my weather cgi file like I do on my page at www.insidemath.com .... whoever can help please do so.

Executing A Shell Command
I try to use the backtick "`" to exacute a shell command from a PHP script. However, `touch file`; doesn't make the file. Neather does exec(), system(), etc. They all work when is used a different command, such as pwd, or ls. So what's a brotha gotta do to creat a file?

Executing Function At A Later Time
I'm making a game sort of thing in PHP and I was wondering if there was a way in PHP that I can pause the execution of a function after x seconds. I don't want the whole script to stop working though, so for example

// function 1

(pauses for 10 seconds) {
// function 2
}

// function 3

i want the script to execute like normal, but pause for 10 seconds before executing function 2, so it would execute function 1 and function 3 then 10 seconds later, execute function 2

this is exactly like the fork() statement found in MOO programming

go here to get a clearer definition.
ftp://ftp.research.att.com/dist/eostrom/MOO/html/ProgrammersManual_37.html#SEC37

is there a way to do this in PHP?

Executing Php From With A Perl Script
I know perl and can write the script. What I want to do is to be able to
grab a page, pass it to php if it has the php extension, get the
results(html) and then send it to the browser. Is it possible?

I saw this bit of code on a server that seems to execute php. Don't know
what it means, but it gave me the idea.

Executing Code Within A Hyperlink
I am writing a photo gallery and suppose 8 photos are displayed. When the
user clicks on a button under the picture, I want it to add that picture
name to a "favorites" list within the session data, but NOT leave the page
the user is on. How could I do this?

How Can I Do Cron Job For Executing My PHP File
How can i do cron job for executing my PHP script once in every day. i want to remind the people about their birthday in reminder.php. that would be one week before thier birthday and one day before their birthday. can i perform this action with cron job?

Executing PHP Code At A Given Time
I was wondering how it would be possible to execute some PHP code every minute for example.. or every hour or on a given date.

Executing Php Blocks In A String
From the examples I've seen, I don't think eval() works for this, or
if it does, I'm not sure how. Here's the setup. I'm storing web page
content in a database. 95% of the time, all the php takes outside of
the content area, setting up menus and footers, that sort of thing.
But some web pages have php code in the middle.

So I'll have a variable, $content, that looks like this:

$content = "<p>I'm content</p>

<?php print "hello world
"; ?>
<p>More content</p>";

How can I get php to execute the code inside the code blocks in the
variable?

Executing Linux Commands W/PHP
I was just wondering if anyone knew how to properly execute a Linux command in a PHP script? I have been trying this: PHP Code:

Executing A PHP Page Without Using The Webserver
We have a job in a PHP page on a Unix server which we have to start in two ways: Via Apache, that's easy and periodically in an automagic way. To execute the page periodically I need a cronjob for it. Has anyone any experience with executing a PHP script using cron?

Executing A Dump.sql File With Php
Is there an easy way to execute a mysql dump located in the same directory as the php file on unix?

Storing/Retrieving/Executing Php
I want to creating an application where all my php(with html) is stored in the database.
So my index.php would find the appropriate the php file associated with the index page. It should execute this new code
as part of the original index.php. Can you please let me know if it is doable?

Executing PHP Program In Console???
I am beginner to PHP.
I read that you can run PHP program in a console window.
How can I do that?

Executing Pkzip On Windows 2K
I have pkzip in my PATH (c:winntsystem32.exe) Now, when I open the windows command prompt and type: Code:

C:phpdevwwwwebsite> pkzip zippedfile.zip filetozip.jpg it works and creates the 'zippedfile.zip' for me.

When I execute it in PHP however: Code:

echo `pkzip zippedfile.zip filetozip.jpg`; nothing happens, no file is created and no output is echo'ed.

Strange thing though: Code: echo `dir`; it outputs the working directory file listing (directory the php script is in) safe mode is off... Am I missing anything?

Executing A Program Remotely With PHP
I need to be able to make the user be able to click a button, which then launches a batch file on my computer.. But passthru() doesnt do the job anymore. And is faulty.. My computer is the server, so it'd also be nice if the command could launch it in a windowed form instead of a background process Here's my code:

Loading Graphic While Executing
I was wondering if there was a way to display a loading graphic until a PHP script has finished executing.

Executing A Function In A Form
I have a form that, when no errors are present, is set to perform two functions. One is to insert the data into a database and the other is to email the results. Right now neither are happening even though I do not get an error message. The functions are contained in an 'include' file. Here's the code i'm using to execute the form parsing: Code:

Executing Php Code With JAVASCRIPT
i have this sample code:

<?php
<a href="linkurl" target="_self" onmouseover="<?php
echo '<a href="linkurl" target="_self">The link title</a>';
echo '<br>';
echo "Original text:";
echo '<br>';
echo "bla bla bla text in its original language";
?>">The link title</a>
?>

as you can see I am attempting to execute php code with javascript "onmouseover"
well the problem is the php code is always being executed, i need to make some kind of check statement to ensure that it will only be executed "onmouseover"

how would I do that? and is this possible to do this with php and javascript?

Executing Command Lines...
I'm trying to execute a command line through ffmpeg.exe in php. Can anyone tell me how this is done.

Also where should I have such an application installed relative to the root of the site?

Returning Value While Still Executing Code
Anyone know of a way to return data to a browser and then continue processing code. For example in classic ASP they have:

<%
Response.write('THE BROWSER CAN SEE THIS');
// sending final response to the browser
Response.end;
// this will still execute even though the browser no longer is waiting for a response
my_function();
%>

I would like to immediately return a value to the browser and then run cleanup code without the browser having to wait. When I use the exit() or die() or return() functions in PHP it will end the code right at that point which is great because the browser gets a response back quickly but the remaining code never gets executed.

External Url
I have tried to make a script, that checks the external url from a popup, but i just get permission denied in javascript. But can this be done in php?

Getting External Ip...
how would I get the External IP of the computer running the php script, and store it in a var named curIP?

Goto Homepage After Executing A Script
Probably a very easy question but I am stumped. I have written one of those tell a friend scripts where you enter your friend's email address and the script sends out an email to the friend's email. The problem is that I want the user to be directed to my homepage after the script that generates the email is executed. Is there a function or something in PHP to do this. Sort of like a goto or redirect function if there is such a thing. Due to reasons I wont go into here the homepage is not and cannot be in PHP. The homepage is just a static html page.

Alternatively, do I just use the action= on my form page ie:

<form method="POST" action= "www.homepage.com" and "sendurl.php">

I tried the above but it does not seem to work for some reason the URL appears on the browser address bar but I end up in an invalid page. It is only when I hit refresh that that the page comes up

If I have confused everyone by what I want to do, all I really want to do the same thing as what this bullitin board does when you submitt a new thread ie: goto thank you page and then a back to homepage or any other page.

Executing A File When A Button Is Clicked
I was wondering if someone could help me. I want to execute a .reg file when the user clicks a certain button. does anybody know how to do this. i already have the file created but i don't know the code to execute it if button clicked.

Parse Error When Executing A DB Query
I am attempting to display the results of a MySql db table to a browser. Its obviously very simple, but I keep getting a parse error on this line...

echo("<p>" . $row["QuoteText"] . "</p>"); PHP Code:

Executing Functions Inside Ereg_replace.
i have tags like: {content:hello} in my string. I want the function to take the 'hello' part and do something with it. I even wrote regexp(i hate them!!)


Copyright © 2005-08 www.BigResource.com, All rights reserved