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.





Shell_exec Using System Tools - Wait For Process To Finish


I have a problem that hopefuly someone here knows the answer to. I want to do a shell_exec command from PHP.

I then want to continue with the script when the shell program is finished with what it does. Problem here is, that will take approximately one hour. How do I make the script wait until the program that I call in shell_exec is finished?




View Complete Forum Thread with Replies

Related Forum Messages:
Wait Until Iframe Finish Loading, Then Resume Code
I have a code where I need to use an IFRAME to load something from external page then display that the process has succeeded, then a message shows that user can close the browser. Now I'm using sleep() to delay the page (and hope that the IFRAME will finish loading within that time). But I dont think this is working as different people have different connection speed. Code:

View Replies !
Open A Command Line Process, Wait, Then Close It After Output?
Basically, and end user views my page, in doing this, PHP on my server will have to run a command line app and display the output in the browser.

This is really simple just by using shell_exec($cmd) where $cmd is something that creates some output.

The problem I'm having is that the program I execute from command line, stays open. This forces a deadlock in php until the process is closed, since it doesn't close itself after the output. Code:

View Replies !
Shell_exec Background Process *Windows*
I am trying to get a shell_exec command to run in the background. So far I have tried:

$ret = shell_exec($ffmpegcmd1." >NUL 2>&1");$ret = shell_exec($ffmpegcmd1." >NUL 2>&1 &");$ret = shell_exec($ffmpegcmd1." >NUL");

without any luck.

View Replies !
Exec(), System(), Shell_exec(), Etc + Nmap
i'm trying to create a script that executes nmap from my server, then displays the output.

i've tried:

$output = passthru('nmap -v -A'.' $ip');
$output = shell_exec('nmap -v -A'.' $ip');
system('nmap -v -A'.' $ip');

the problem i'm having is that using the above methods i only get the first line of output, ie.

Starting Nmap 4.20 ( http://insecure.org ) at 2007-08-31 21:46 CST

and nothing else. i've managed to find a way around it by sending the nmap output to a textfile, the using file_get_contents() to pull the data back in:

exec('nmap -v -A '.$ip.' > /usr/local/www/apache22/data/nmap/'.$ip.'.html');    
$file = "/usr/local/www/apache22/data/nmap/$ip.html";
$result = file_get_contents($file);
echo "(pre)$result(/pre)";

that works perfectly, but i'd rather not be writing anything to the drive. i guess the problem might be that nmap takes about 5-10 seconds to do its scan, and for some reason php doesn't want to wait that long, i really have no idea. can it be made to work without needing to write to files?

and for the curious minds, i'm not doing anything dodgy, i just wanted an online tool i could access from any computer to test networks i support .

View Replies !
Exec, Shell_exec, System, And Passthru Not Working At All
Can't get these commands to work! The following page simply doesn't
finish loading ( Waiting... Opening... :-( )

<?php echo system("dir"); ?>

The same for <?php echo exec("dir"); ?> or <?php echo
shell_exec("dir"); ?>, etc...

I'm running Apache 2.0.55 & PHP 5.0.5 with Zend Optimizer v2.5.10 on
windows XP SP2.

View Replies !
Wait $x Seconds, Or Wait Until The "exec" Command Is Finished?
I'm working on a script that will dump a MySQL database to a file with exec(mysqldump [args]), then will let the user download the database.

The dump may take a few seconds, so I want to user to be forced to wait before downloading the file.

How can I tell my script to wait $x seconds before performing the next step in the script?
Even better, would be the ability to wait until the dump is done. Is this possible with PHP?

View Replies !
System(), Exec(), Shell_exec(), But "Permission Denied"
I want to execute the php script via web server to run linux command. I try to use system(), exec(), shell_exec(), but the system show me "Permission Denied". i have set the file permission by using chmod 777 file.php .

View Replies !
Code Doesn't Finish In 3 Seconds
I'm trying to execute a portion of code within a specific number of seconds. If it fails, I need to break out and do something else. To give you an idea of what I mean, take a look at the pseudo code below:

--------
try to complete the code below for 3 seconds { do something that could take a long time. if it doesn't complete within 3 seconds, generate an error which will abort the processing of further instructions in this try } catch (Exception $e) { Execute some different commands since the code above didn't finish quickly enough.}
---------

View Replies !
Long Time To Finish A Program
I have a perl program called by my php script, which in turn is called
by the browser. Now, the perl program is called using exec, but takes
a long time to finish. So, till the time the perl script does not
finish its job, the browser does not show anything. I have messages
like "Dont close this window", but that does not show up till the
whole perl program finishes. Is there a way, I can somehow remedy
this, try to show a message on the browser - "Please while your data
processes" and then do the processing in the background?

View Replies !
Let Script Finish Even Users Close Their Browser
I am using Linux, php and mysql.

When I run my script, it will take a very long time. So when users
close their browsers, my scripts stop either. What I want to do is let
the script continue running and send an email at the end.

How can I successfully do that?

View Replies !
Allowing User To Return And Finish Survey Later
I am writing a web-based survey and would like to allow users to log off and return later to finish the survey. I believe that I should use cookies but have no idea how to go about it.

How can I allow users to return to a survey at a later point in time without losing their data from the previous visit (on the same form). (The survey will have multiple pages.)

View Replies !
Using Sessions To Pass Vars From My Form.php->verify.php->paypal->finish.php->mailer.php.
I'm using sessions to pass vars from my form.php->verify.php->paypal->finish.php->mailer.php. I think I'm mixing versions of php sessions...dunno. The host I'm using has v4.2.2 with sessions enabled and the $HTTP_POST_VARS works well posted directly from form.php...but I think is messing me up in the mailer.php. I've tracked the session_id() all the way thru but the vars are not being passed into the final mailer.php. Fix? Code:

View Replies !
Loading... Please Wait Script?
What's the best way to handle a "Loading, please wait" type of page? We have a link that generates a large file and would like to tell the user what is going on. Maybe have it up there for 20-30 seconds or so. Is it just a matter of a pop-up while the main window loads the file? Is there a way to detect if the file is loaded then close the pop-up?

View Replies !
How Do You Make A Script Wait
I would like to introduce a short period of waiting time in a script. In the online manual, I found a PHP function called m_uwait that is supposed to do just that for a specified number of microseconds, but when I ran the script, m_uwait came up as undefined.

Does anyone know of a way to pause execution for a few seconds?

View Replies !
Wait For Result From Exec
If I wish to run an external application with exec(), does the execution of
the PHP script halt until the external application has finished?

View Replies !
Wait Time Bypass
I have a file hosting site where users can upload and download files. The download link makes everybody wait 30 seconds before it starts automatically downloading.

I want to make it so users who are logged in (through a previously coded login system) do not have to wait the 30 seconds. Code:

View Replies !
Howto: Please Wait, This May Take A Few Seconds...
what if i have a webpage that displays the text "please wait, this may take a few seconds..." and it now waits until some event on the server happens.

whatever this is, this can be quick, but it could also be slow, or it can even fail. but once this event has happened, i want the webpage to reload and display a different message, like "the process completed successfully". Code:

View Replies !
Display Wait Message
Im using exec() function in my php program, but it takes time to get the output in my page. After I press submit button and before running exec(). function, I wrote please wait message. The problem is this message doesnt coming before the command complete executed. Here also Im using flush() and sleep() functions to get output progress
line by line. I need help to display wait message immediately after I press submit
button.

View Replies !
Displaying A Please Wait Message
I need to display a please wait message followed by the actual page when the processing has finished. The actual page should overwrite the please wait message. I've tried using header status codes, but they either mess up the page or just leave the please wait message still being displayed. I've seen this technique being used, but haven't been able to find out how it is done.

View Replies !
Wait 3 Seconds And Redirect To Referrer
I am working on a form processor for a client. When a user's input fails validation or upon successful completion of the form, the user is redirected to a page that indicates the failure or success.

I need for the form to wait 3 seconds and then direct the user back to the referring page (the form). I've seen examples and am trying to get it working, unsuccessfully so far.

Can anyone take a look at the code sample to tell me what I'm doing wrong? I'd greatly appreciate any input. Here it is: PHP Code:

View Replies !
Is There A Wait, Or Timer Kind Of Function?
What I want is a function, that will hold the script for a bit before letting it continue. I want it for things like "You are being redirected in 5 seconds" of "Your download will start in 5 seconds" and stuff like that.

Is there a function or a way I can do this fairly easily?

View Replies !
Wait X Seconds To Insert Data
I am writing one guestbook script , create_entry.php is the file to insert data to MYSQL from form. I would like to know the scripts: "wait X seconds to insert data to MYSQL" to anti-flooding ?

View Replies !
Session And Wait Time For Download
I have a download.php file which is used by my file hosting website and there appears to be a problem with the following code :

if(!$_SESSION['loggedin']) {
$wait_time = 0;
} else {
$wait_time = 20;

}

This code above is supposed to make it so that users who are logged in can bypass the 20 second wait time. The problem is that it is not recognizing it for some reason and nobody gets the wait time... any way to fix this?

View Replies !
Create A Pop-up Window To Ask The User To Wait Until The Upload Is Done?
I have a scrip to upload an audio file to the server, How I can create a pop-up window to ask the user to wait until the upload is done? I'm using the "copy" function to upload the file.

View Replies !
Make User Wait 2 Hours Before They Are Allowed To Do Something
i'm trying to make the user wait 2 hours before they are allowed to do something. I store the timestamp (time(); ) in field and then when the user wants to do something, i call the field with the timestamp that was stored in it and then compare it to see if 2 hours has elapsed.

$newtime = storedtimestamp + something;
$time = time();
if($newtime < $time) {
echo"time is up. continue...";
} else {
echo"You still have some minutes remaining.";
}

View Replies !
Mass Mailing Script/waiting For Script To Finish.
I have built a newsletter/mass mailing system that loads templates, supports multiple newsletters and mailing lists, etc. The problem I have is this:

I start a query loop which pulls the persons name and email address from a mysql database, populates the template for that newsletter then sends the message using the phpmailer class. The script takes ages (hours) to execute when your sending to 10,000+ people and so the window has to stay open till the script finishes. Is there a way to start this process running and continue script execution without having to wait for all the messages to go before finishing script execution?

View Replies !
Problems Getting Hit Counter To Wait One Hour Before Updating/logging Last Ip
Im trying to make a hit counter that logs ip,browser, date and time. It works ok, except that I would like it to wait logging hits from last IP for one hour. How do I modify my script to do this ? Code:

View Replies !
Form Inside Loop, Need To Wait Till Submit Is Activated.
I have the following.

$result=mysql_query($sql);
$nrows=mysql_num_rows($result);
for ($i=0;$i<$nrows;$i++)
{
$row_array=mysql_fetch_row($result);
echo "<form name='testform' action='ins_op.php' method='post'>";

lots of form stuff

echo "<td><input type='submit' value='Save'>";

echo "</form>";
}

I'd like to have the loop wait until the form submit is pressed before
it continues and grabs the next record from $row_array.

Right now the code displays all the records with their submit buttons.

Doing it in this form permits one query to the database to get all the
open records.

View Replies !
Php Rad Tools
i was wondering whether tools such as codecharge studio and webdev are commonly used in the php community. They seem to be quite powerful and claim to save a lot of coding time for developers, what are your thoughts?

View Replies !
GIS Tools
I just wanna to ask is there GIS tools that can be use together with PHP? And is there any way to make GIS tools in a web based applications so that user can search using the map.

View Replies !
JSP To PHP Tools
I have majority of my projects in JSP. I am seeking tools that can convert JSP to PHP. May I request the PHP gurus to guide / advise regarding above mentioned requirement.

View Replies !
CMS Tools
It does just about everything you could want to do in a CMS. I'm hesitant to use something like this because it seems like just about anyone can use it and build a fairly high-end site without any web development skill sets what so ever. Does this bother anyone else or is it just me.

I'm bothered that simple graphic designer think they can claim to be web developers because they know how to choose a couple options in this Joomla CMS and whola! They've built a psuedo forum function or search feature for a site. Where does that leave us developers? How to compete with this CMS tools.

View Replies !
Shell_exec Help Please
I have an ensim server which provides me with about 20 scripts in the filesystem that allows you to create sites, edit them, lookup domains, etc... I am running a few of these scripts from a cron I made and that all works fine but I can't seem to find a function (like shell_exec) that allows me to get the text returned from the function. When I run the script from CLI and i run the script using either system(), exec(), passthru(), or shell_exec() it just displays the results, and I didn't tell it to, it just does it on it's own bit. My question is how can i trap the results so I can anylize them.

View Replies !
CLI And Shell_exec()
I am using Imagemagick and some other apps via command line calls (if I stated that correctly, hope so).I run a WinXP server, Sambar 5.3. I use this format for my typical call: PHP Code:

View Replies !
Ssh With Shell_exec
I'm trying to 'ssh' into another machine, run a small script and fetch
it's output, using shell_exec(). The problem is, it takes AGES to run
ssh and I don't know what's happening. If I try 'ssh'ing manually on the
shell, it takes a microsecond to fetch the result, whereas shell_exec
takes very very long and I don't know how to debug the problem. That's
problem number one: How do I tell what's happening and why is it taking
so long?

Problem two: To be able to establish a password-less ssh connection, I
generated a public key/private key pair for the two machines and stored
it in my /home/username/.ssh directory. Okay, I know apache/php (by the
way I'm running apache with PHP 4.2.3) won't know where to find it so I
presumed /opt/apache/.ssh would be the best place to copy the ".ssh"
directory (i.e. apache's installed in /opt/apache). Now the problem is,
I couldn't get shell_exec to run ssh in a password less mode. After a
little while I realized that it was looking for the private key in
"/.ssh" (i.e. the root directory)! How come? How do I change it so that
it looks for the .ssh directory elsewhere? (I mean, how can I run a
command using shell_exec and ask it to use the "home" directory of the
"apache" user, which normally is /path/to/apache)? The last time I
installed php & apache, I remember it looked for the .ssh directory in
the /opt/apache/.ssh directory and now it has changed. also, it was much
faster the last time. Now for some reason it's EXTREMELY slow (takes a
whole minute to run ssh) and looks for the .ssh directory on the root
(and I dont want to place that directory there).

View Replies !
SSL Through Shell_exec
I've looked at the php documentation for openSSL, but found that the module seemed insufficient for purposes like checking a certificate's expiration date on another server. That is, I could not find a function to run "openssl s_client -connect", so I decided to instead achieve it through shell_exec.
This is a three step process:

1) Check the openssl version via shell_exec('openssl version -v'); just to confirm that openssl is installed and runs properly.
This returns "OpenSSL 0.9.7a Feb 19 2003 "

2) Connect to the remote server. As a test, I decided to use www.gna.org, since I know they use a certificate. shell_exec('openssl s_client -connect www.gna.org:4433');

This pauses for about 20 seconds, and then returns FALSE. I've tried various combinations, like removing the -connect argument but leaving the server name in, removing the port, including the https:// part, removing the www, and so on. I have not tried a port other than 4433 yet (I wouldn't know what other part to use). All other methods returned FALSE immediately. This is the only method that delays 20 seconds, which indicates to me that I'm close.

3) Fetch certificate expiration date via shell_exec('openssl x509 -enddate'); although this obviously returns FALSE because I have not been able to connect to the server yet.

View Replies !
Cd With Shell_exec
I have the following script:

$c_path = "/absolute_path_to_some_directory";
$test_cmd = "cd $c_path; ls";
$test_res = shell_exec($test_cmd);

it always lists the contents of the directory where it is placed, rather than the contents of some_directory. In other words, it appears that cd is not working. I have verified that path and permissions are correct. PHP is version 4.3.9.

View Replies !
Shell_exec
I want to copy file from remote machine to local machine using PHP. On both machines Linux operating system present. The code is.

$result=shell_exec("scp admin@192.168.1.236:/mnt/disc/hda/part1/demo/
conn /opt/lampp/htdocs/upload/");

View Replies !
Visual Tools
In the archives there's reference to a visual editor for php from Http://www.soysal.com/

View Replies !
PHP Design Tools? IDE?
Im an experienced database+software designer and developer,
but, unfortunately, anything to do with web-programming and
web-systems designs is still a pretty new area to me...
(been working mostly with "legacy" environments the last 10 years)

So I am writing this, hoping to get some useful advise and feedback...

I have done some pretty trivial, small websites with html/PHP,
and now starting a bit more advanced one, where I will need SQL
database-support, and will probably go for MySQL.

Of course, I have read some elemantary tutorials and articles on the web,
but still wonder how PHP is actually being used in practice when
creating bigger web-sites...

Is PHP usually handcoded?
Like... you just make up a database, then a number of tables you think will do,
and finally (what I am most concerned about) a multiplicity of different
PHP script-files in an ad-hoc fashion?
(I hope not, since it seems that this will quite soon produce a pretty
diffcult-to-maintain-and-grasp mess of the whole system)

So what I would like to learn, is what nice (preferrably free/open-source)
tools for design and project-management are available?

My idea is that you would like to have some IDE application, something
like VB or Delphi or VC++, where you design your webpages and
forms in a graphical manner, and you can code "event" pieces of code
that will react to clicks, buttons and user-actions like
in the traditional IDE:s.
And then there is some "compiler" or rather that do all the boring routine-work
of converting your design to html/PHP code.
The page-designs would also be based on "templates", of course,
so its flexible to modify if you want to change the look-and-feel
of your whole site.

Ideally, I would also prefer that the whole website-design
would be stored in a separate, fixed set of tables in the database,
rather than in a zillion different script-files, CSS-sheets, etc.

I can also envision a design where, even if the website contains
a huge number of pages and different functions,
there would actually only be a single PHP-script "index.php"
and all sub-pages are generated on-the-fly, from arguments
in the URL, i.e. all URLs simply looking like:

index.php?pageid=1
index.php?pageid=2
...
index.php?pageid=productlist
index.php?pageid=registration
index.php?pageid=loginform
index.php?pageid=contactform

etc...

The index.php startfile might only look something like:

<html>
<php?
include("lib.php");
main();
?>
</html>

Then all pages would be generated on-the-fly by the main() function
(defined in "lib.php", along with a host of useful subroutines),
and driven by the URL-parameter 'pageid' and the overall site-design
somehow stored in the database.

All design-work you did in the IDE (graphical, code-snippets, etc)
would then actually be stored in the DB, and the PHP script-files
could then be a quite static PHP-implementation of an "engine"
reading the DB-content and outputting the HTML-code and pages.

View Replies !
Documentation Tools
I'm searching for a tool to generate documentation of PHP Code. Maybe, it could be very similar to a reverse enginerring software tool with reporting feature about funtions, methods definition, references, etc.

View Replies !
Develop Tools
What is the best tool to develop a php-website ? I used Macromedia Dreamweaver MX and Zend Studio. Are there better tools ?

View Replies !
Integrate UPS Tools
I need to integrate UPS Tools with website in PHP. But I have no idea of doing it.

View Replies !
Reporting Tools
I am running php on linux. So what tool i can create and display a
report? Crystal reports doesn't support php & linux !!!

View Replies !
CDR Tools And Syntax
I am trying to figure out what variable the following line is looking for. I know what it is trying to do, but can't figure out where it is trying to call it from.

<form action="<?php print $this->url() ?>" method=post>

View Replies !
Trace Tools
i am looking for a software or way to trace my php codes. i tested zend and phpdesigner but i cannot find that i want. i want trace step by step (line by line) and in each line the software showes me.

View Replies !
Basic Shell_exec
I am trying to use shell_exec to do some scheduled clearing up but can't get it working.
PHP Code:

View Replies !
Exec Or Shell_exec
I am trying to us shell_exec and keep getting an error. I do have safe_mode = off also.
Code:

if ($publish == "yes")
{
$command = "e:scriptspublish.bat";
$result=shell_exec($command); }

The publish.bat file does work and I have proper permissions set in windows, I set everyone full access. Oh, Windows server, IIS6.0, PHP. Error is as follows:

Warning: shell_exec() [function.shell-exec]: Unable to execute 'e:scriptspublish.bat' in

View Replies !
Shell_exec Need Any Configuration?
Anyone can provide me information on how to did the configuration in the unix there to make the shell_exec() can work properly?

View Replies !
Shell_exec() Return Nothing
I ran into a problem with shell_exec() PHP and all files hosting on Redhat I have a html page that allow me to enter a linux command, then submit, then I get the output print out between $output.

when enter command: ls -l /etc, it a list of file and directory on /etc as expected
however, when I tried to execute my program at /etc/earch/esearch (esearch is executable), I received nothing back.

however when I telnet to server, command /etc/earch/esearch does return some text.
i'm sure php was running as same user as telnet.

View Replies !
Shell_exec, Python
Read some garbage tutorial on About.com about embedding my python script inside PHP with shell_exec() but it's not working, as I expected.

Does some kind of configuration have to occur first for this to happen?  I have python installed but I can't run it from anywhere at my dos prompt.  I have to be in the python25 folder (i installed using a windows installer on python.org) for it to work.

I'm running IIS, Win2000, Python 2.5.1, PHP 5.2.3

View Replies !
Shell_exec On LightTPD
I've got a very simple script with shell_exec that's giving me a headache! My server is a NetBSD machine running LightTPD (1.4.8nb1) and php (5.1.1nb2).

I've got the file dummy.php with the following content:

<?php
error_reporting(E_ALL);
$res = shell_exec("pwd 2>&1");
echo $res;
?>

When I access this file through a browser i can't see any output:

http://my.url/dummy.php results in a blank page that loads in no time! No error messages, neither output by the browser or in the log files (php.log and LightTPD's error.log). 

When I use the terminal on the servern it all works fine:

php /path/to/wwwroot/dummy.php gives me the working directory. Doesn't matter from which working directory I execute the command, or which user (I've tried the LightTPD user aswell). It works every time! 

safe_mode is off and there are no disabled_functions!

I've asked around in LightTPD forums, but they say it's a PHP problem. So, I've asked around in (other) PHP forums but noone seems to have any ideas how to solve this! 
Perhaps there are expert users here that can help me, or at least redirect me to some other expert forum.

View Replies !

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