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

Related Forum Messages:
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 !
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 Replies !
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 !
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 !
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 !
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 !
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 !
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 !
External Script Call
When the user submit a file, this file is transmitted to a php page that will call a perl script to process the file. The execution time can take up to one minute and I would like to keep the user informed all along the execution by printing the output of the perl script as it comes. (the perl script prints information about it's status : "15% complete") I can't figure out how, and right now the php hangs until the perl script has finished and I get all the perl script output in the end, in one time. Here is my code:

<?
(...)
echo "Ok, File upload succeeded<br>";
$file_path= "C:somewhereupload".$name;
echo "<br>";
echo system("C:hereis_myscript.pl $file_path");
unlink($file_path);
(...)
?>

View Replies !
Call A Script/program
If you modify a php script/program can you call the script yours? I mean if you make changes that enhances the value of the program or allows it to do more than in its original state, would you be able to call it your own? Or do you get part credit?

View Replies !
Blocking Exec Call
Is there a version of exec(), or something similar, which will block until the system call is complete?

View Replies !
Exec, Passthru Disabled So How To Call C++ .exe File?
I am at my wit's end trying to get information out of Streamline.net's
support dept about my problem. They reply quickly enough, but seem to try
and give out the least possible amount of info each time. The transcript so
far is reproduced for your amusement below.

To summarise:

I've put up a Sudoku-solving program called Sudoku.exe. I want to call it in
a php script to solve a puzzle and output the solution. It works fine with
Apache/php on my own machine, but it seems Streamline.net disable exec,
passthru etc. They eventually say, cryptically: ' CGI executables are
supported, however this is very different from executing a program from
within a PHP script'. So how would I call my Sudoko.exe file?

The 'dialog':

My last question seems to have been 'fixed' before being answered, so I'll
have another go.
I'm trying to call an .exe file on the server but get an 'unable to fork'
error message. I have Apache/php installed locally and it works fine. Do you
have to turn on 'cmd.exe' permissions or something? Try it yourself at:

Warning: passthru(): Unable to fork [Sudoku.exe (argument...)] in (.php
file...)
It's the same with exec() as well.

We do not support passthru or exec functions.

So how would I call my Sudoku.exe program from a php script?

I do not want 'scripting help', I just want to use some of the functions
that you offer as a host and which I have paid for.
As I have said what I am trying to do works perfectly on my machine, so it
must be a question of something you have to enable your end. What do you
mean you don't support passthru or exec? They are both standard php
commands.
.

You asked "how would I call my Sudoku.exe program from a php script?"
clearly this is asking us how you can use scripting?

Certain functions are disabled in PHP for security reasons.

Which functions are 'disabled in PHP for security reasons' ?

You can find this out with the inbuilt php function phpinfo()

Could you tell me where on the page that phpinfo() produces these functions
are listed? For example, passthru() does not appear to be on the page.
.

search for "disable_functions" on that page.

disable_functions lists 'no value'. So again, could you tell me where I can
find the list of standard php functions which you have disabled?
Please can you provide a link to your phpinfo file so we can investigate
this further.
We had previously checked this on a linux server, which showed the functions
that have been disabled. We've passed this on to an engineer to investigate
further.

For your information the following are disabled:

shell_exec,exec,system,passthru,popen

Your knowledge base says:
Q. Are CGI (Common Gateway Interface) executables supported?

A. Yes these are supported on either the Windows and Linux servers

But you are telling me that the only php functions which can call my
executable are disabled. Will you clarify once and for all if I can call my
exe file or not. I AM NOT ASKING FOR SCRIPTING HELP, I have books about
that. I just want to know if I can do ON YOUR SERVER what you say I can do,
and if not why not.

View Replies !
GLOBAL OBJECT IN EXEC COMMAND CALL
I have an object:

$special = new special;

Let's say I have a function:

class special {
function outputtext() {
return "test";
}}

now let's say I want to use the exec command to output that text:

exec("/usr/local/bin/php -r 'echo
$special->outputtext();'",$returnarray,$returnvar);

I get an error call to a member function on a non-object. Any ideas how to pass teh GLOBAL OBJECT var into the shell exec command? I am haivng a terrible time figuring out what to do.

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 !
Call To Undefined Function: Printer_open() In C:Program FilesApache GroupApache2htdocsprinter.php On Line 4
I want to print something. But i get the error : Call to undefined
function: printer_open() in C:Program FilesApache
GroupApache2htdocsprinter.php on line 4
follow by a messagebox : unable to load dynamic library './php_printer.dll'

Where can I find this library?

I have change my php.ini in :
extension=php_printer.dll

I take the example code

<?php

$handle = printer_open();

printer_write($handle, "Text to print");

printer_close($handle);

?>

View Replies !
Fatal Error: Call To Undefined Function Mysql_connect() In C:Program FilesApache Gr
I am getting the error :

Fatal error: Call to undefined function mysql_connect() in C:Program FilesApache GroupApache2htdocsfirstdbprogram.php on line 4

I have PHP 5 installed,apache and mysql.

PHP is installed in c:php

IN the phph.ini I have done hte following: Code:

View Replies !
Main Program Call Another Main [GET]
is it possible to call from a main program another one the same as it is
done by the browser?

If I begin I am able to do http://server/main.php?name="test" in the
browsers URL.

Could I do such a submission inside of a program and how?

View Replies !
How Is Call Exec("/usr/usr/bin -C $U2 &");
This will not work, does any one know why?

exec("/usr/usr/bin -C $U2 &");

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 !
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 !
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 !
External Variables
It's probably not called an external variable... but this is what i need. I have a new design that uses a template... so it works like this:

call up index.php (containing variables like content), this includes the template.php (includes the "backbone"). Now the template also calls up a few other pages (like the header, sides and bottom) but I need it to call up something else.. Code:

View Replies !
External Script
I have a script which reads a data file, reads the characters one by one and if a certain character is meet it does something else, at the moment it echos the fact that it meet a certain character. I need it to take the characters it has read up to that point and present them to a database field thats forms part of a set of fields that will be updated at once. Then it will continue to read the remainder of the file and
repeat the process until it reaches eof. Is there something similar to goto or gosub, I did some checking and was laughed at, as you can probably tell I'm a newbie. Maybe I should be calling an external script.

View Replies !
Output As External XML
the following code runs a query on a database and outputs the results as XML within its self. I have attempted to get the php page to create a file called rss.xml but have failled.

I have tried using $file= fopen("rss.xml" , "w"); but my knowlege of PHP wouldn't be the best or anyway near to the level of being able to modify the below page to do as i wish, would someone be able to take a peep at the page 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 !

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