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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Exec() - Running An External Program From Inside PHP.


I'm having difficulties running an external program from inside PHP. I'm trying to create thumbnails using ImageMagick's convert utility using the following program: PHP Code:




View Complete Forum Thread with Replies

Related Forum Messages:
PHP Running Exec() Windows Program Very Slow In Comparison To UNIX Equivalent Program
Does anyone have an explanation or solution for the following.
I have a PHP script that uses exec() to call a program to do certain
calculations.

The UNIX version of this program I call runs in about 4 to 5 seconds.
When I run the same PHP script using exec() to call the Windows equivalent
of this same program on my Windows desktop, it takes about 32 seconds....

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 !
Call Exec To Run An External Program Through A Form
I have problem with "Exec" function in PHP5. When I call Exec to run an external program through a form, it fails but when I run my PHP page by PHP interpreter like: PHP MyPHP.php it just works fine and external program executes successfully.

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 !
External Program Via PHP
I need to execute a command-line program through PHP. I have a form which includes a textarea, where the user writes his data. These data will be used as input for the commend-line program. Will I go something like:

$data = $_GET['info'];

Which function shall I use? System, exec, shell_exec, passthru? I can't choose which one is the correct. By the way, the command which I use when I write the script in the command line is :

program_name [argument1 -> A database file] [argument2 -> info supplied by user]

So, in the function that will be used, the data supplied by the user will be passed as my second argument (the 1st argument is a file in my hard disk). And, lastly, do I need to change any global settings for PHP in order to perform such actions, ie running scripts via PHP programs?

View Replies !
How To Run External Program
i would like to use php to run external program in window environment like open a macro program to let it run at window background.

I try to use exec to run the window command, it works, but when i try to use exec to
run other program, like this..

exec("run xxxx.ttl") // xxx.ttl is a macro

the php will hang... anyone has sample on how to use php to run external program in window environment??

View Replies !
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 !
Opening An External Program
I was wondering if there was a way to be able to create a PHP program that when you click on a link or image on a webpage that it would automatically open up an application in the client's computer.

I have a webpage that is sort of an 'engineering catalog'. Each item on that catalog is linked to a downloadable file. When a user clicks on this item, it should be able to open an engineering application, and pass the downloadable engineering file from the webpage into the engineering software application. Any ideas?

View Replies !
How To Launch External Program
somebody know how to lauch external program? for example: i will open my browser, click one image of that web page and then the application (i.e media player )of my local pc will pop up and ready to use.

View Replies !
Execute External Program
I need to execute a command-line program through PHP. I have a form which includes a textarea, where the user writes his data. These data will be used as input for the commend-line program. Will I go something like: Code:

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 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 Replies !
How Do I Make Sure That An External Program Does Actually Exists?
web host said there is a program /usr/bin/convert I can use to convert image files, after I call it in my code, it does not seemed to be doing anything. I'm sure the command line is right because I echo the commandline to make sure. How do I make sure that an external program does actually exists? I use if (file_exists "/usr/bin/convert")), is there any othe way? Or am I doing something wrong that the system call is not working? For example:

//convert test.jpg to converted.jpg
$command = "/usr/bin/convert "test.jpg" "converted.jpg"";

echo $command;

system($command);

View Replies !
Start External Program (winamp)
I have my own PHP/apache/mySQL server at home with public IP address and I have my personal page there. I wan't to have a button (input type button) and a PHP function -> onClick start external program and end srcipt. I've tried do it with Exec and fopen functions but it freezed and didn't run the program Code:

View Replies !
Problem Calling External Program
have a little problem with exec/passthru or similar. I need to open an email-client from php to send an email. One would now ask why not use a normal phpmailer.

It is only for use on my personal computer, and if needed I need to be able to change some input before sending the mail. The Client is KMail on SUSE 9.1. Code:

View Replies !
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 Replies !
Running Program
I have a program called "rlx" that takes two arguments and writes a file. The command line could be "~/rlx file b" and it executes correctly from shell. What it does is to write a file to webserver/rlx/file.dat. The permission for the program rlx is 755, the permission for the dir rlx is 777, and the text output from the program after having run it is correct. (It displays the filename and other data). Code:

//Commandline tried are all these, just one of them in the real code of course:
$commandline = "/home/me/rlx/rlx file b";
$commandline = "/../../rlx/rlx file b";
// since above didnt work, i tried to copy the program file to the web directory, renaming it to rlx2 so it doesnt have the same name as dir
$commandline = "rlx2 file b";
$commandline = "/.rlx2 file b";

// one of following in the real code of course
exec($commandline);
system($commandline);
shell_exec($commandline);

View Replies !
Exec() Not Running
I just installed ImageMagick on my development machine (OS X 10.4.7, Apache 1.3, PHP 4). I am trying to use exec() to call it. I have created a command via PHP:

PHP Code:

$cmd = "/usr/local/ImageMagick-6.3.0/bin/convert /Library/WebServer/Documents/one.jpg -resize 250x /Library/WebServer/Documents/photos/two.jpg"
exec($cmd, $output, $retVal);

I know ImageMagick is correctly installed because when I run the command via the console, it works perfectly. The "photos" directory is chmod'ed to 777. The paths are correct. I have tested a simple "ls -l ." as the command, that outputs everything just fine.

Is there somehing I'm not doing right? Someting I need to disable or enable? I've gotten this exact code to work on a different server (GoDaddy of all places) so I'm quite certain it's not the code itself.

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 !
Check To See If A Program Is Running
Is there any specific way to check to see if a certain program is up and running? Like I want something to pop up only if program ****.exe is running.

View Replies !
Running Exec As Root?
exec('/sbin/ifdown eth0');

does not work, due to needing to be run as root.
I need to have this work on a closed network environment.

View Replies !
Running External Perl Script
I wish to run an external perl script from one of my php pages. To run the script from the command prompt I use text_cat.pl -l "This is some sample text"

How do I run this from a php script? I have used shell_exec but this loads an external command prompt window, is there a way to hide this window?

View Replies !
PHP Exec Calls A C Program That Creates A File
I'm using exec to call a compiled C program that creates/writes to a
file...However this doesn't seem to be working....
I tried setting all the permissions to 777 but still nothing...?

View Replies !
Launching A Program With Exec & Pstools/psexec.exe
I am trying to launch a program with PHP code. I am running Apache on Windows XP SP2. Code:

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 !
Using A Variable Inside Of An EXEC() Statement
I am running into an issue...

exec('schtasks /CREATE /ST 15:00 /TN $id /TR c:second.php /SC once /RU "NT AUTHORITYSYSTEM"');

above is the command i am trying to execute within a php script, and $id is a variable that is passed through another program. $id is represented by a 5 digit number.

What i am trying to do is create a task once my script runs that has the $id number as the task name.

each time i run the above, my task is named $id and not the number that the variable represents.

View Replies !
Access External Variable Inside A Function...
i have the following code in a function:

function initiate() {
if (!$_SESSION['usrIsLoggedIn']) {

$login_url = $config['page']['login'];
header("Location: login.php");
exit();

}}

now, the $config array is defined on a page, that is included at the top of this page...
what i would like to know is there a way to access the $config['page']['login'] data, without haveing to include it when i call my function.

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 !
PHP Variables Inside External JavaScript File (workaround?)
I have been trying to really separate JavaScript from HTML/PHP, just like with CSS. My problem, is that I am having problems passing a PHP variable or making use of it through an external JS file. If I was using inline JS I could pass it like:

<a href="bla.php" onclick=return confirm("Delete this item: <?php echo $item ?>")> Delete (works) </a>

However, using similar code in an external JS file, simply passes through as text. Is there any way to accomplish something similar?

The new code is much nicer: <a href="bla.php" class="delete"> Delete (doesn't quite work) </a> IS there a way to keep code this clean and properly separate the JS from the HTML while at the same time keeping the PHP $variable working?

I am well aware that JS runs on the client, and PHP on the server, I am just hoping to somehow pass this variable through some work around, if not I will keep using the inline version.

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 Code Inside Of Quotes?
I'm calling a function that returns a table in html. I want to populate this table with results from a query. I'm having a problem because the return statement is in quotes.

function return_display($queryresults){
return ' How can I run a loop in here? ';
}

View Replies !
Php Running Inside An Iframe And Session Data And IE
I have a php app running inside an iframe. I pass a piece of info to this iframe through http parameters, php gets it and then set it in the session.  However, the session data is lost when I read it from another php page within the same php application. Code:

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 !
Problems Of PHP Script Running Perl Program With Spreadsheet::ParseExcel Module
My php script is to call perl scipt which makes use of
Spreadsheet::ParseExcel module to parse Excel file. I am able to launch
php script from command line so that perl script can run and properly
parse Excel file. However, when I put php script on server side and
then launch php through client request, perl program can't run.



View Replies !
Loop Running Inside A Loop
Having a problem with the following; PHP Code:

$last_id = mysql_insert_id();
    
$type_count = count($types);
    
for ($i=0; $i < $type_count; $i++) {
        
$match = "";

if ($types[$i] == $featured[$i]) {
    $match = "y";
    }
                    
    $q_add_types = "INSERT into company_ins (Id, company_id, ins_id, type_featured) VALUES ('', '$last_id', '$types [$i]', '$match')";
        mysql_query($q_add_types) or die(mysql_error());
}

The INSERT query does not run when I insert the inner parenthesis. Does anybody know why?

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: Invalid Argument Supplied For Foreach() Running On A OS X Machine Running Apache 1.x And PHP 4.x.
The following script was running on a OS X machine running Apache 1.x and PHP 4.x. I just moved the script over to a Linux machine running Apache 2.0.51 and PHP 4.3.8, and now the foreach line does not work. It says Warning: Invalid argument supplied for foreach()

in /var/www/localhost/htdocs/warehouse/whse_order_submit.php on line 39

Here is the script:

<?php
//get the variables from the other page
$id=$_POST['id_no'];
$sku=$_POST['sku'];
$description=$_POST['description'];
$order=($_POST['order_qty']);
$store=$_POST['store'];
$comment=$_POST['comment'];

$ip=$REMOTE_ADDR;

//check if store is empty
if(empty($store)) {
die("Store is required. Please press the back button and enter in your store.");
}

//connect to the database
require('../inc/database_conn.php');

//$month=getdate(mon);
//$day=getdate(mday);
//$year=getdate(year);
//$today=$year . "-" . $month . "-" . $day
$today=date('Y-m-d');

// create the unique order number

$headerqry = "INSERT INTO misc_order_header (order_date, store, comment, ip) VALUES ('$today', '$store', '$comment', '$ip')";

mysql_query($headerqry, $conn) or die(mysql_error());
$order_no=mysql_insert_id();
foreach($order_qty as $id_no => $val) {
if($order_qty[$id_no] > 0) {
$detailqry = "INSERT INTO misc_order_detail (order_no, id_no, sku, order_qty, order_date, store) VALUES ('$order_no', '$id_no', '$sku', '".$order_qty[$id_no]."', '$today', '$store')";
mysql_query($detailqry, $conn) or die(mysql_error() . "<BR>" . $detailqry);
}
}

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 Call *.exe Program From Php Program
I have a php program, and from that program I wanna call C program that counts number of visitors on my page.

This is a piece of my program:

View Replies !
Two Sessions: Session A By A Program Destroys Session B By A Program
I have two separate programs that I want to use together on a website
Program A starts first and calls session_start(). Program B is started by the user clicking on a link and it also calls session_start(). The session started by program B blows away the session started by program...

View Replies !
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?

View Replies !
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?

View Replies !
External RSS
I am using PHP to parse some RSS feeds that appear on my home page. The problem is, if one of these feeds hosts is slow, it slows down my page load time. Is there a way to set a time out, so if that RSS feed isn't loaded within a certain it can be skipped.

View Replies !
Loading External Dll
I extract the php-4.0.4pl1-Win32 into my local PC C:php directory. I follow all the instruction in install file and find that the php script work. Then i go to uncomment the entension for external dll that needed in win.ini and also change the path extension_dir=C:phpextensions.

the problem is each time i load the php script, it will prompt out the error message "unable to load dynamic library "c:extensionsphp_oracle.dll". can some one help me to resolve this problem?

View Replies !
External DOMEntity's
I have a question about PHP5's DOM, but I found the docs on this section are either incomplete or incorrect (e.g. wrong return types for several functions). How can external entities, or entities in general, be added to a DOMDocument? (I'm not asking about adding entity references because DOMDocument->createEntityReference works like a
charm.)

I should probably state the details around the problem: I am working on a templating engine that utilizes PHP5's DOM interface (http://xire.forizon.com for details) so for caching purposes if I can make the output document include cached versions of other templates via external entities (XInclude is already used, but not it isn't supported
very well on the client side), then any client-side caching can also be utilized.

View Replies !
External PDF File
Is there a way for me to be able to fetch a PDF from another site and display it on my website without having to open up Adobe Reader?

In other words, I would like to have this PDF document: http://flightaware.com/resources/airport/ASE/APD/AIRPORT+DIAGRAM/pdf

to be displayed on a page when a user opens a page on my website.

View Replies !
OO External Template
I am trying to figure out how to make an external .tpl file with all the HTML and call it from the Object. Code:

View Replies !
Url In An External Php File
Situation: I have an external php file with a function in it that returns a value with document.write like this:

<?php
Header("content-type: application/x-javascript");

function myfunction()
{
return $something;
}

$some_variable=$something;

echo "document.write("Some_Text: " . $some_variable . "")";
?>

When called remotely by javaScript, the php function behaves perfectly returning the desired variable:

<script> type="text/javascript" src="http://www.mydomain.com/remote.php"></script>

The Problem:

I would like to display the "Some_text:" part with an active link as in
<a href="http://www.yourdomain.com/">Some_text</a>

So that when executed, the JavaScript displays the link with an anchor text. How can I write this code into the echo document.write function?

View Replies !
External JavaScript
I am using phpBB and wanted to display latest poll in phpBB to my home page. My home page is html extention and want to use java to call it and display it. I am stuck with these codes;

php codes;
<? php
SOME, SOME....
{
echo "document.write('$poll['options'][$i]['vote_option_text']');";
} ?>

if ['options'] then will not print anything, if I remove ' ' then print something. However if I put all 4 items ('$poll['options'][$i]['vote_option_text']');"; without ' ' inside of [ ] it will print like;

Array[0][vote_option_text]Array[1][vote_option_text]Array[2][vote_option_text]Array[3][vote_option_text]Array[4][vote_option_text]Array[5][vote_option_text]

What is correct syntax?

View Replies !
Getting External Data
I am logged in to Yahoo with my Yahoo ID, and I visit:

http://baseball.fantasysports.yahoo.com with my browser, it will tell me which Fantasy Baseball leagues I am in, and allow me to click on one to enter the league page.

I figured therefore, that if I were already logged in, that the following code, would display the same page (i.e. I would be able to see which leagues I am in):

$remotefile=fopen('http://baseball.fantasysports.yahoo.com/','r');
while (!feof ($remotefile)) {
$line = fgets($remotefile);
echo($line);
}

Unfortunately, the resulting page asks me to sign in, and doesn't display the desired leagues. But I AM still logged in to Yahoo. If I were to try to visit:

http://baseball.fantasysports.yahoo.com again in my broswer, it knows I'm still logged in and displays my leagues.

View Replies !
External Banner
we are building a large agency website and are looking for a php code that a agency can copy to their website to display our banner so they get their free account, in our admin panel we want it to automatically check our code is on their site and as soon as it is removed it changes status. Maybe in admin it shows green button when it is on and when it is removed changes to red, as we have far to many to manually check daily.

View Replies !

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