Sleep(), Exec() And MySQL
How to create dynamically generated table .....
View Complete Forum Thread with Replies
Related Forum Messages:
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 !
Exec Or Shell_exec For Dumping MySql Info?
I'm trying to figure out how to export info from a Mysql database, using PHP to manage the export, as phpMyAdmin manages to do. I'm guessing I need to run a shell script that looks like this: mysqldump -u username -ppassword database_name FILE.sql and I need to call this shell script using one of the functions on this page: Code:
View Replies !
PHP Sleep()
I've been sitting for quite a while now, reading the sleep() manual and tried to turn the code upside down and inside out but nothing helps... I want the current page to wait a few seconds before it is directed to another ( after a successfull registration ). So i thought the best way to do that is to use sleep(). However, this does work to a certain point ... the current page waits for 5 seconds, but the text I want to show the user in the meantime doesn't show? Why? Without the sleep() and the header() it shows without any problem. Code:
View Replies !
Sleep()
I tried to make a script which would print a line of text at 1 line per second or whatever time i put. So i went ahead and tried this. PHP Code: echo "Passwords match."; sleep(1); echo "Passwords match."; sleep(1); echo "Passwords match."; sleep(1); echo "Passwords match."; This is a example and the text in echo has no meaning. However the sleep waits and waits for all the other sleeps to finish and then prints out all text at once.
View Replies !
Warning: Exec() [function.exec]:
I'm using PHP Version 5.0.4 in IIS5, Window 2003. When I execute my script, it prompt me the following error : Warning: exec() [function.exec]: Unable to fork [ping 10.8.1.70] in c:Inetpubwwwrootswitch.php on line 62 Below is my script : <?php $line1 = exec("ping 10.8.1.70", $output); exit; ?>
View Replies !
PHP Messaging And Sleep
I would like to get my php script to send a message to a user for example to notify that a DB update or insert has been successful or not. After that the script will be redirected to the home page. how can this be done ? I have tried using sleep(5) to delay the script but that does not work the way that I want it to since it simply delays the execution of the ENTIRE script RATHER than a part of it !!
View Replies !
Sleep() In The Background
how much the sleep() which is set to no limit can consume the system resource. Could it cause to hang the server? I tried the following and couldnot see the server got busy. Although the browser seemed to be so, if I access to a different page, it responded very quick as usual. It's not a big deal, is it? sleep.php PHP Code: <?php set_time_limit(0); sleep(0); ?> fork_sleep.php PHP Code: <?php $str = "php -f sleep.php"; exec("$str > /dev/null &"); ?>
View Replies !
Fsocketopen & Sleep
I'm trying to setup a fsocketopen script to ping a site every 15 minutes or so and if the site is down, send an email. I'm thinking of using ignore_user_abort() to run the script in the background and sleep() for the time intervals. I'm not really sure how to script this out.
View Replies !
Sleep And Max_Execution_Time
I have the following code: $i=0; while($i++<15) { mail("rantsh@hotmail.com",date("d m Y H:i:s"),"This is email # $i "); echo "mandado $i <br>"; sleep(60); } Now, I know my server has a 30 second max_execution_time setting... nonetheless, this code runs successfully!!!. Now, this is actually better for me (for the application I need to run)... Yet I'm concerned of why it's being allowed to run for 15 minutes if max_execution_time is set to 30. Code:
View Replies !
Would I Use Sleep To Delay
I am making a site for a friend, but with his PHP it always renders too quick and I would like it to wait a bit for the rest of the page to load, otherwise its a bunch of annoying gaps and whacked alignment as the CSS and images load and it all just looks annoying as it loads. And it takes away from the order of of information outputted as it goes through the PHP when your focused on the tripped out layout.
View Replies !
Sleep Function
I'm playing about with delaying results of a PHP program. I want to print some results then wait for a few seconds and print some more. I have found the php sleep function however have a small problem. <?php echo ("The time in 3 seconds from page loading: "); sleep(3); echo date('h:i:s') . " "; ?> The above script is meant to print the top line, wait 3 seconds and print the bottom line. Infact, it starts, waits 3 seconds and prints all at once. Now from my understand from php.net it should not sleep untill it hits the sleep command in there.
View Replies !
Sleep For 10 Seconds Help
I am trying to run it will load an iframe for every entry found in my DB, I am trying to make it sleep for 10 seconds between each iframe with: PHP Code: sleep(10); PHP Code: $train = "<table width=800 bgcolor=F0F0F0 aling=center><tr><td colspan=4> $pages<br></td></tr>"; $i=0; while ($addall = mysql_fetch_assoc($res)) { Â Â Â Â if ($i/2 == ceil($i/2)) $train .= "<tr>"; Â Â Â Â $i++; $train .= "<td width=120 valign=top><BR><iframe src="potspace.php?u=$addall[intId]" width="400"></iframe>"; } $train .= "<tr><td colspan=4><br><br> $pages<br><br></td></tr></table>";
View Replies !
Session Timeout, Use Of Sleep Ect...
I have a custom script that uses sessions to track UID's. The only problem I have with the script is that the session times out in 1440 (min?) which I believe is 24 min. I was thinking that I could use php's sleep to hold off from doing a refresh until minute 20. Unfortunately, I have also read that using sleep can leave a server open to a DoS attack. I do not have access to the php.ini file to be able to change the timeout variable for the session. What is the best way to keep a session open without changing the .ini variable. Is sleep a good way do go about it, and if so, are there significant security risks in using sleep()?
View Replies !
Sleep() Affects The Variables?
could it be that the sleep() function affects my variables? When I set a very long delay time (1-3 hours) in my CronJob PHP4 script (of couse with a big set_time_limit) some of my variables go lost! But there's no problem with short times in the sleep-function (1-5 min). set_time_limit(86400); for($x=1;$x<5;$x++) { echo $x; //$x will be shown only one time sleep(7200);}
View Replies !
Need To Flush Before Sleep But I'm Blank.
I'm new to php and am converting a bunch of asp pages to php. Current problem : I am using a Submit button on a form to POST ( send the database variables ) to a php page that will send a personalised e-mail to each client. On the php page, I am looping through a database, compiling a message ( html format ), and mailing the message to my client. After the mail has been sent, I need to wait for 4 seconds before continuing with the next database record. I am using this code after the mail has been sent : echo "Mail Sent to : " . $row['CliName']; ob_flush(); flush(); sleep(4); Problem is, that nothing appears after I click on the Submit button on the first page's form ( the first page just remains on the screen ). Once the database has been looped, the entire (correct) output appears on my screen - but I need to see some sort of progress as it works it's way through the database.
View Replies !
Sleep(900) ? Delayed Query... ?
Trying to set a marker in a MySQL table on our Primary host (WAMP stack) indicating whether or not there is current User Activity -- ON THAT SERVER -- as a signal to remote Secondary -- tablet pc based servers to skip scheduled database synchronization with the Primary. Code:
View Replies !
Sleep() And Browser Load.
is there a way to get around the browser continually acting like they are loading when using sleep()? It says the page is still loading but it really isn't because we are causing a delay for some data on purpose with php. So it is for an intentional reason that we cause it. Many of us like using sleep(). Anyway to do it without the browsers showing the page is still loading? There must be a way, so many programmers for intense programming use sleep(), I can't imagine they have to deal with the browsers loading prompts whenever they do.
View Replies !
Staggering Execution With Sleep()
For my site, currently in development, I will be hosting some latest RSS picks from friend websites. To start with there will only be a couple, but eventually I hope to be sourcing from up to 50 partner blogs. Obviously, i dont want to make a request on every page load, so I would instead cache data from the past half hour/hour. I will be using CRON to schedule an update every so often, but having a single script making 50 requests one after the other then processing and storing the data may be taxing, especially if the outside server is slow. I thought about using sleep() to leave gaps between each request so that a sudden hogging of resources doesnt happen every hour. What are your views on this method? Is it feasable (and possibly even a good idea), or should I just get it all to execute in one go?
View Replies !
Resources Used When Using The Sleep() Function
I want to use the Sleep() function in a script that may run multiple times, but i dont want hte system to crash or be overloaded with scripts in memory. When the script enters a sleep mode, what happens to the script? is it resident in memory? if so could i experience the system bogging down if there were 100+ scripts resident in memory or are they just sitting there doing nothing until they run again?
View Replies !
SLEEP + Header Problem
I'm running a community website where I send out weekly newsletters to all of my clients. However, I'm sure my hosting provider wouldn't be so happy if I just FOR LOOP and send it all out at once. SO what I did was I just a SLEEP and a header mthod that triggers after every second, where the header sends out GET variables for the next iteration to fetch at which account I am currently at to send the next newsletter. Code:
View Replies !
Insert Sleep Every X Rows
i am trying to insert a sleep command in my loop every 100 rows, the below works for every 2 but if i try to sleep every 100 rows it will not work. if($i % 2) { sleep(5); } does not work [php] if($i % 100) { sleep(5); } [/php
View Replies !
Long Sleep() And Time-out's
The script I'm writing needs to wait a random amount of time (1-300s) between each iteration of a loop, eg. while(condition) { do something //wait between 1s and 5 minutes sleep(rand(1,300)); } Problem is, a browser times out if it doesn't get an answer within about 30 seconds. Is the idea of having a PHP script sleep for a longer amount of time incompatible with web applications? Any work-around?
View Replies !
Putty Processlist Command Sleep
I'm using php with mysql. I am connecting through putty and I run the command for processlist. Lately I am seeing many threads with the command "sleep" in them. My site and the database are running smoothly, but I am seeing up to 200-300 threads like this with the command "sleep". Can anyone tell me what may be causing this and how do I resolve it? Or is it normal to see this when your site grows to a certain size? Code: ......
View Replies !
Require_once And Fatal Errors... Automatic Sleep And Try Again Anyone?
I have a PHP page which loads OK 80% of the time. However the rest of the time I get the following error: Fatal error: Failed opening required 'DB.php' This really bugs me, especially since the only reason this is happeneing seems to be due to server load. I would like to add code so that instead of displaying the given error, the PHP code makes the HTTP response thread simply sleep a little bit (say 4 seconds), and then retry, and repeat until the file can be opened. It seems strange to me that server load would prevent the file from being opened. Anyhow, any ideas on how I can improve the situation?
View Replies !
SHOW PROCESSLIST "sleep"
when i view SHOW PROCESSLIST i always see command sleeps with some large times behind them.. can somone please tell me what that is and what that might be caused by? "Command" Sleep "time" 1585
View Replies !
Exec();
well i know that exec("ndc reload"); would perform that command.. but i want too print out on the page what the command tells when i do like this: [root@xermin cryzeck]# ndc reload Reload initiated. [root@xermin cryzeck]# i want to print that Reload initiated. on the page.. how? not just echo("reload initiated"); but the stuff the command tells.
View Replies !
Using Exec()
I'm trying to use the exec() function to call shell scripts that in turn startup various programs under linux.. for example, when someone clicks on a link to restart a particular daemon, the daemon will then simply executed, either through the standalone command of /location/daemon or through the calling of a shell script that essentially performs an identical task. My problem is that exec() seems to only work through the user "nobody," which the Apache web server is running under. The scripts and programs I'd like to execute are under a user account named "admin." I've even tried chmod'ing all pertinent files w/ permissions that "nobody" could use to successfully access all necessary commands, without success, as the programs seem to crash whenever I do this.
View Replies !
PHP And Exec(dir)
I have been using opendir and scandir, but I want to try something else. Idea: using dir, and a) getting the result b) saving it as a file. As I have problems with executing files directly, it create a bat file and executes that. I can execute command, but by some reason I dont get any response (it should return something, and I get "") The missing response is why I create a file. I create the file on the network ( serversomewhere ) like this dir "serversomewherefilesdir" >"serversomewhere esult.txt" Here is the odd thing: dir cannot read from the network - the bat file is created there, it creates the result.txt file, but emtpy as it cannot read from the network. Reading from c: and it works.
View Replies !
Php Exec();
i've been trying to create a php script that writes some text to a file, then runs the perl interpreter on the file and shows the output. it works ok when valid perl is written to the file, so if i use 'print "hello world";' then it outputs 'hello world'. the problem is, if i enter invalid perl code, such as 'blahblahblah;', it outputs nothing. i'd like the php script to be able to get the error/output. does anyone know of a way to do this?
View Replies !
Exec(); & Php As CGI...
I have had to do some work on a RAQ server with php as cgi. The script I have written uses the exec(); function to run pgp to encrypt a file. Weird thing is this: The script does everything it's supposed to but I get the RAQ internal server error message. Should I be using passthru of something else in this environment? Forgive me I am a relative virgin as far as RAQs and php as cgi goes.
View Replies !
Exec Php
I have a php site. Some page needs to call an external program. The programs are home made c# applications. It uses to work without problem. For a while. Maybe it work for some hour. Or for a day. Or even for a week. At a certain point, when a php script calls the exe file, the application freezes. The following happens:...
View Replies !
Exec()
I am making a simple php script using exec() to execute commands in my linux host. When i execute 'ls' it shows the right content on that directory, but what i want to know if there is a way i can distinguish between folders and files. In this way i can lets say make folders show in black and files in grey. Also when i execute a wrong command i wanna get any system error message. Code:
View Replies !
Exec A .exe
I want to exec dos then within dos exec another.exe then write to that program with database varables or session's but how? how do you write to the last.exe program to give it it's command? <?php exec("C:/WINDOWS/system32/cmd.exe/program.exe"); ?>
View Replies !
Use Of The Exec()
<?php f($_POST['startup']){ if(!$online){ //$A1 = array(); //exec($servpath."khyller-server.exe") or die("<BR>Server Startup MSG - <Font color=red>Cannot find Server</font>"); //proc_open("call C:Serverlanked eleasekhyller-server.exe", $A1,$A2,$A3); } } ?> I'm first trying to get them to work at all just do something first. but with no success. I even sued or die and all I get is die D: Is it impossible or am I just dumb? I know I did this one, But I don't know how. Edit to add php color. my eyes were hurting in blackness.
View Replies !
Using EXEC
I've got a page on an application form that runs an executable. I don't return anything from the executable, and I don't want to the script to wait for it before continuing. I just want it to call the executable and forget about it. The executable is self contained, in doesn't return anything back to the script. I'm currently executing with EXEC like so: Code: exec("c:filename.exe " . $_SESSION['memberId']);
View Replies !
Exec() And Zip
I have zip.exe in my PATH on a windows XP box. Additionally, I have a script which, if I execute locally with php myfile.php. it runs fine. However, when I call myfile.php remotely with a web browser, it canot seem to find zip.exe. Below are the releveant code snippets. exec( "zip -mj ackups empcookbook.zip ackups empcookbook.sql 2>&1", $output, $res ); if( $res 0 ) { error( true,"COMPRESSION FAILED ".implode( " ", $output)); COMPRESSION FAILED The system cannot execute the specified program.
View Replies !
SU And Exec
I have a PHP CLI script setup in crom which runs as a specific user each night so that it has the correct security level. I want to also be able to execute this script "on demand" via a webpage. Is there a simple way to get PHP to execute this command as another user? How could I "SU script_user >>> runme.php" ?
View Replies !
About Exec()
I have a small custom 404 page in PHP. When this page is triggered I'd like some information about the requesting client, including its reverse IP. I would like the 404 page to be returned to the client's browser immediately, after invoking another function or script that takes care of the lookup & email duties. The 404 page doesn't care about the return value of the second script at all, it's fine if it fails. It looked to me like exec() is appropriate here, is that correct? Am I thinking about it wrong?
View Replies !
Exec ()
i want to add new Linux user in my system: exec ("useradd ........"); is not working . there is no error . but user is not getting added. Am i using the command in wrong way. is ther any alternative.
View Replies !
Exec() Fails...help!
I'm very new to php, running apache 1.3.20 with php 4 on a 98 box just for home test development purposes there's probably an easier way/better alternative to do what i'm trying to do, but i'd be greatful for solutions not alternatives i'm trying to add a user to an .htpasswd file so need to exec("c:/apache/htdocs/htpasswd.exe -b .htpasswd user password) It would also be useful to run a mail server remotely with exec("c:mymailserver.exe") but neither will work, i tend to hear the standard windows error sound, but with no message. Apache error logs reveal nothing. What i'm trying to do may be impossible?, i'm new to the language so i don't know...or it may be a permissions problem? Or perhaps something totally seperate? If anyone has any ideas which may help i'd be very greatful for any advice you could give.
View Replies !
Exec & IIS Problem
I have an exe that I want to run with php. In the console, it works perfectly fine. There is a problem with security and it doesn't seem to run. I have tried the following after reading various newsgroups and websites and no luck. 1) Put the Exe file in the wwwroot and set permissions to the IUSER, giving Read&Execute, even gave Full Control. 2) I also added Everyone too and still no luck 3) Moved the exe file to system32 folder and did the same above and still no luck
View Replies !
Exec Is Not Working Right
I'm trying to convert a video with exec i have just installed php 5.0.5 on my server and every thing seems to work except exec can you help i have tried <? runExternal( "ffmpeg -i video.mov -s 320x240 -r 30 video.flv", &$code ); if( $code ) echo "bad transcoding"; else echo "looks good"; function runExternal( $cmd, &$code ) { $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("pipe", "w") // stderr is a file to write to ); $pipes= array(); $process = proc_open($cmd, $descriptorspec, $pipes); $output= ""; if (!is_resource($process)) return false; #close child's input imidiately fclose($pipes[0]); stream_set_blocking($pipes,false); stream_set_blocking($pipes[2],false); $todo= array($pipes[1],$pipes[2]); while( true ) { $read= array(); if(!feof($pipes[1]) ) $read[]= $pipes[1]; if(!feof($pipes[2]) ) $read[]= $pipes[2]; if (!$read) break; $ready= stream_select($read, $write=NULL, $ex= NULL, 2); if ($ready === false) { break; #should never happen - something died } foreach ($read as $r) { $s= fread($r,1024); $output.= $s; } } fclose($pipes[1]); fclose($pipes[2]); $code= proc_close($process); return $output; } ?> and <? exec("ffmpeg -i video.mov -s 320x240 -r 30 video.flv"); ?> and <? system("ffmpeg -i video.mov -s 320x240 -r 30 video.flv"); ?> None worked ....
View Replies !
PHP Locking Up With EXEC?
I have been using EXEC and or SHELL_EXEC to call several command line functions. I use it mostly for Image Magick on my web servers. I run a WinXP machine with Sambar Server 5.3, PHP verison 4.3.0 ISAPI. Until lately the server, php and image magick have functioned like a dream. I have been lately having some very serious crashes where the DOS window that appears then disappears with a command call from PHP does not leave the screen, it simply freezes. The web server continues to function but any addiional EXEC (or realted) commands do not process, the DOS window remains on the screen. I run my server as a service and not an applicaiton though I experimented both ways. I have not changed my config lately other than to add maybe another dozen domains to my server's vhosts.ini file. Other than that, nothing has changed. The ONLY way to terminate the problem is to KILL THE PROCESS for the server (for sambar folks that is ntserver.exe) then restart the service. One should not ever need to do this but this is the only way to get the bubble out of the way, so to speak. The service itself will not stop, it must have the process killed. Does this sound strange. Is there a bug with PHP ... maybe it is there but it just seems so odd that it is intermitant, most times the EXEC goes of with out a hitch, but with significantly increased frequency it freezes up. Now I went into the list of processes to see if it was tying up system resoureces, it does NOT.
View Replies !
PHP System() And Exec()
Background: I am trying to execute a binary on the server located in the current directory where the php script is being run. The server is a linux (debian based). I am having trouble getting php to execute the binary properly, below is my code. Code:
View Replies !
Exec() On Windows
this is my problem: I need to "exec" the following command: C:ProgrammiSoftsoft.exe -v -d C:dati$nomefile C:datipdf$filename and i tried to execute it in php with (one of) the following lines.... exec("C:ProgrammiSoftsoft.exe -v -d C:dati.$nomefile C:datipdf.$filename"); exec("C:ProgrammiSoftsoft.exe" -v -d "C:dati".$nomefile "C:datipdf".$filename); exec("C:ProgrammiSoftsoft.exe -v -d C:dati.$nomefile C:datipdf.$filename"); exec("C:/Programmi/Soft/soft.exe -v -d C:/dati/.$nomefile C:/dati/pdf/.$filename"); exec("C:/Programmi/Soft/soft.exe" -v -d "C:/dati/".$nomefile "C:/dati/pdf/".$filename); but there is something wrong and that i.. do not understand... Is there anyone so kind to show me the correct line and a couple of comments on how to built it? I tried to search for it (manual, newsgroups...) but i haven't found it (and my mistakes are the result :-P)
View Replies !
Exec And $_GET
If I execute a php script with exec exec("foo.php"); and foo.php reads the $_GET array (can't change that I must work with $_GET), how can I set values to $_GET array? Can I do it directly in foo.php? $_GET['foobar'] = 4; Or exec(foo.php?foobar=4); ?
View Replies !
Exec() On One Vhost?
Is there a way to enable exec() for one virtual host on a server? Safe_mode is on globally (and off for the one domain), and exec() (and other fns) are disabled globally. However, I cannot use exec() from the domain of interest.
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 !
How To Get Errors From Exec?
I am running PHP 4 and this code is failing, in that it does not insert the records into MySQL // Upload the data to file to the db. exec("mysqlimport --replace --fields-terminated-by=',' --fields-optionally-enclosed-by='"' --user=$db_user --password=$db_password --host=$db_hostname --lines-terminated-by=' ' $db_name $new_src_file_path", $output, $return); Sadly, the $output array is empty, but the $return value is 127. Does anyone know what that means or how I can get more meaningful error output?
View Replies !
|