Re: [PHP] Execute permission question
On Thu, 27 Oct 2011, Tedd Sperling wrote: You answered a question I wasn't prepared to ask, which was How can php scripts be executed when their execute permissions aren't set? Because as far as the system is concerned, the thing which is being executed is either PHP itself or something in which PHP is being run (e.g. Apache). The fact that PHP then loads a script and executes it is not really the point. When used in websites, it's the webserver itself which loads the PHP interpreter which in turn loads the script. So the webserver needs to be executable. The Apache module, for example, does not because Apache loads it into Apache which is already running. If you're not actually running programs on the host itself via a shell, then you probably won't need execute permissions most of the time. Geoff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Oct 28, 2011, at 7:19 AM, Geoff Shang wrote: On Thu, 27 Oct 2011, Tedd Sperling wrote: You answered a question I wasn't prepared to ask, which was How can php scripts be executed when their execute permissions aren't set? Because as far as the system is concerned, the thing which is being executed is either PHP itself or something in which PHP is being run (e.g. Apache). The fact that PHP then loads a script and executes it is not really the point. When used in websites, it's the webserver itself which loads the PHP interpreter which in turn loads the script. So the webserver needs to be executable. The Apache module, for example, does not because Apache loads it into Apache which is already running. If you're not actually running programs on the host itself via a shell, then you probably won't need execute permissions most of the time. Geoff. Geoff: Thanks -- this is one of those things that normally goes without saying but by doing so remains a question to some. Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Oct 27, 2011, at 7:49 PM, Daniel Brown wrote: On Thu, Oct 27, 2011 at 19:44, Tedd Sperling tedd.sperl...@gmail.com wrote: One of the things I'm trying to understand is a php script can execute a shell command, right? Is there a way via permissions to prevent that -- or -- does that even have anything to do with it? That's where I'm fuzzy. Sure. What PHP actually does is interface with a forked shell (usually 'sh' by default) process, and the shell then has permission controls and requirements of its own, defined by the operating system's configuration. So PHP isn't actually executing the commands, per se, but is instead instructing the shell to do so itself. To see how to limit PHP's shell access, look into safe_mode and the like. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ Daniel: Thanks. But does having execute permissions set on a script affect the scripts ability to run shell commands? For example, if I have a script that contains a shell command, can I prohibit that script from executing the command by setting it's execute permission to not execute? Certainly, as is my normal custom, I could try it and find out for myself -- but I have always been reluctant to use shell commands. Besides, never having used them, I don't see their advantage yet. Currently, they seem strange and dangerous to me. As always, your insight is welcomed. Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Fri, Oct 28, 2011 at 11:01, Tedd Sperling tedd.sperl...@gmail.com wrote: But does having execute permissions set on a script affect the scripts ability to run shell commands? Negative. It won't inherit permissions, though one might expect that to make sense. For example, if I have a script that contains a shell command, can I prohibit that script from executing the command by setting it's execute permission to not execute? No, the best you could do is disable all shell access, or limit the commands that can be run via the shell, but the latter option is getting beyond the scope of a PHP question. Certainly, as is my normal custom, I could try it and find out for myself -- but I have always been reluctant to use shell commands. Besides, never having used them, I don't see their advantage yet. Currently, they seem strange and dangerous to me. If you're doing it on php1.net, you're safe. The only damage that can happen on that server is to your own account. That's unfortunately not true of all hosting providers, but you're good there. ;-P -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Oct 28, 2011, at 11:07 AM, Daniel Brown wrote: On Fri, Oct 28, 2011 at 11:01, Tedd Sperling tedd.sperl...@gmail.com wrote: But does having execute permissions set on a script affect the scripts ability to run shell commands? Negative. It won't inherit permissions, though one might expect that to make sense. For example, if I have a script that contains a shell command, can I prohibit that script from executing the command by setting it's execute permission to not execute? No, the best you could do is disable all shell access, or limit the commands that can be run via the shell, but the latter option is getting beyond the scope of a PHP question. Certainly, as is my normal custom, I could try it and find out for myself -- but I have always been reluctant to use shell commands. Besides, never having used them, I don't see their advantage yet. Currently, they seem strange and dangerous to me. If you're doing it on php1.net, you're safe. The only damage that can happen on that server is to your own account. That's unfortunately not true of all hosting providers, but you're good there. ;-P -- /Daniel P. Brown Mucho thanks for the clarification, information, and authorization. I'll keep that in mind re php1.net and try not to be a teddzilla when I investigate shell commands. :-) Cheers, tedd PS: I have not trimmed the post because I think it is important to repeat this. t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Execute permission question
On 28 Oct 2011 at 16:01, Tedd Sperling tedd.sperl...@gmail.com wrote: On Oct 27, 2011, at 7:49 PM, Daniel Brown wrote: But does having execute permissions set on a script affect the scripts ability to run shell commands? No, as Dan has said. But if you have a file called wiggy, containing the following: #!/usr/bin/php ?php echo Hello World!\n; ? then you can run it at the command line by typing its name at the prompt - but wiggy will need to have execute permission set. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute permission question
Hi gang: Another question -- in the context of file permissions (rwx) is the execute permission limited to shell commands -- Or -- is there more? Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Thu, 2011-10-27 at 14:41 -0600, Larry Martell wrote: On Thu, Oct 27, 2011 at 2:26 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi gang: Another question -- in the context of file permissions (rwx) is the execute permission limited to shell commands -- Or -- is there more? Not sure I fully understand your question, but to execute anything directly - shell script, python script, perl script, binary program - you need the x bit set. I say directly because you could do: 'perl script' without script being executable (because in that case it's an argument to the perl executable). HTH, -larry Yes, I just ran a quick test PHP script without any execute permissions set at all, only rw-rw-r-- and it ran just fine, suggesting it is just an argument as Larry said. I don't think Apache needs execute permissions set on PHP files or pages either, only read rights. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Execute permission question
On Oct 27, 2011, at 4:51 PM, Ashley Sheridan wrote: Yes, I just ran a quick test PHP script without any execute permissions set at all, only rw-rw-r-- and it ran just fine, suggesting it is just an argument as Larry said. I don't think Apache needs execute permissions set on PHP files or pages either, only read rights. -- Thanks, Ash Ash: You answered a question I wasn't prepared to ask, which was How can php scripts be executed when their execute permissions aren't set? That question begged the question of What does execute mean? I find the topic of permissions complicated when they can be overridden elsewhere. Thanks, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Thu, Oct 27, 2011 at 18:15, Tedd Sperling tedd.sperl...@gmail.com wrote: Ash: You answered a question I wasn't prepared to ask, which was How can php scripts be executed when their execute permissions aren't set? That question begged the question of What does execute mean? It means execute. Not to be confused with what others are mentioning here, which is read and interpret. If you run something through PHP, Perl, Python, or another parser/interpreter, it doesn't need to be executable by the user, only readable. A caveat to this, of course, is that some scripts (such as those run via CGI) will usually need to be executable. You may recall, back in the 90's, that any Perl scripts you'd upload to your cgi-bin needed to be chmod'd to 0755. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Oct 27, 2011, at 6:27 PM, Daniel Brown wrote: On Thu, Oct 27, 2011 at 18:15, Tedd Sperling tedd.sperl...@gmail.com wrote: Ash: You answered a question I wasn't prepared to ask, which was How can php scripts be executed when their execute permissions aren't set? That question begged the question of What does execute mean? It means execute. Not to be confused with what others are mentioning here, which is read and interpret. If you run something through PHP, Perl, Python, or another parser/interpreter, it doesn't need to be executable by the user, only readable. A caveat to this, of course, is that some scripts (such as those run via CGI) will usually need to be executable. You may recall, back in the 90's, that any Perl scripts you'd upload to your cgi-bin needed to be chmod'd to 0755. -- /Daniel P. Brown Thanks for the wayback machine ride -- my memory cells have long expunged that data for more useless information. Good point re comparison of execute vs read and interpret -- that will end up in the minds of students to ponder. Thanks, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Oct 27, 2011, at 6:27 PM, Daniel Brown wrote: On Thu, Oct 27, 2011 at 18:15, Tedd Sperling tedd.sperl...@gmail.com wrote: That question begged the question of What does execute mean? It means execute. Not to be confused with what others are mentioning here, which is read and interpret. If you run something through PHP, Perl, Python, or another parser/interpreter, it doesn't need to be executable by the user, only readable. A caveat to this, of course, is that some scripts (such as those run via CGI) will usually need to be executable. You may recall, back in the 90's, that any Perl scripts you'd upload to your cgi-bin needed to be chmod'd to 0755. -- /Daniel P. Brown One of the things I'm trying to understand is a php script can execute a shell command, right? Is there a way via permissions to prevent that -- or -- does that even have anything to do with it? That's where I'm fuzzy. Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute permission question
On Thu, Oct 27, 2011 at 19:44, Tedd Sperling tedd.sperl...@gmail.com wrote: One of the things I'm trying to understand is a php script can execute a shell command, right? Is there a way via permissions to prevent that -- or -- does that even have anything to do with it? That's where I'm fuzzy. Sure. What PHP actually does is interface with a forked shell (usually 'sh' by default) process, and the shell then has permission controls and requirements of its own, defined by the operating system's configuration. So PHP isn't actually executing the commands, per se, but is instead instructing the shell to do so itself. To see how to limit PHP's shell access, look into safe_mode and the like. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute my php code before every php call
Hi all, I have a simple code that override some env vars but i need it to run before any other php code on every php execution. I would like to avoid any change of all php code (even if its only to include the include command). Any one knows of such way ? I dont mind overriding this vars on php configuration file but i dont have any control of it as its should work on even the most strict web hosting (that still allow env vars manipulation) Any alternatives ? Thanks, TL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute my php code before every php call
On Jun 12, 2011, at 1:46 PM, techloop wrote: I have a simple code that override some env vars but i need it to run before any other php code on every php execution. Have you looked at http://us.php.net/manual/en/ini.core.php#ini.auto-prepend-file ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute my php code before every php call
On 12 Jun 2011, at 19:46, techloop techloop...@gmail.com wrote: Hi all, I have a simple code that override some env vars but i need it to run before any other php code on every php execution. I would like to avoid any change of all php code (even if its only to include the include command). Any one knows of such way ? I dont mind overriding this vars on php configuration file but i dont have any control of it as its should work on even the most strict web hosting (that still allow env vars manipulation) Any alternatives ? Thanks, TL Look up the auto_prepend_file php.ini configuration option. That should give you the functionality you're after. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ Sent from my leaf blower -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute a php page and don't wait for it to finish
Hi List, I have a php page that updates data from one database to another when it is run. My query is, how can I trigger the execution of this update page from another php / javascript without the calling page having to wait for the update page to finish? Basically, I think the update page needs to use: ignore_user_abort(1); set_time_limit(0); // I don't think the script will take more than 1 min. At the other end I found this: 1) http://www.mindraven.com/blog/php/run-a-php-script-in-the-background-using-ajax/ 2) On that page a user suggested using *pclose(popen(‘/usr/bin/php /path/to/something.php /dev/null ’, ‘r’)* **However, I need this to be usable on windows servers also. 3) Finally, would pcntl_exec, pcntl_fork, exec or something be useful for me? Which of the above 3 options is the better one? Other suggestions are welcome :) Thanks and Regards, Ferdi
Re: [PHP] Execute a php page and don't wait for it to finish
On Tue, 2010-10-19 at 18:50 +0530, Ferdi wrote: Hi List, I have a php page that updates data from one database to another when it is run. My query is, how can I trigger the execution of this update page from another php / javascript without the calling page having to wait for the update page to finish? Basically, I think the update page needs to use: ignore_user_abort(1); set_time_limit(0); // I don't think the script will take more than 1 min. At the other end I found this: 1) http://www.mindraven.com/blog/php/run-a-php-script-in-the-background-using-ajax/ 2) On that page a user suggested using *pclose(popen(‘/usr/bin/php /path/to/something.php /dev/null ’, ‘r’)* **However, I need this to be usable on windows servers also. 3) Finally, would pcntl_exec, pcntl_fork, exec or something be useful for me? Which of the above 3 options is the better one? Other suggestions are welcome :) Thanks and Regards, Ferdi Ferdi: check out: http://us3.php.net/manual/en/function.ignore-user-abort.php I am looking to change a script/app that i have to use this (as the script takes a few seconds to finish, and there are people hitting the back button, or soemthign else that is screwing the submission. I haven't implemented it (life has been busy) yet, but it seems to be what I was looking for, which may be what you're looking for... Steve. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute a php page and don't wait for it to finish
What about simply having the script trip a flag that another background script checks every 60 seconds or so? Once a minutes a background script checks to see if it needs to preform any tasks. When a user hits a certain page it does an ajax request to trip this flag and immediately returns. The next time the background script checks if it needs to do anything, it sees the tripped flag and preforms the relevant database copy - or whatever :-) Chris. On Tue, Oct 19, 2010 at 9:20 AM, Ferdi ferdinan...@printo.in wrote: Hi List, I have a php page that updates data from one database to another when it is run. My query is, how can I trigger the execution of this update page from another php / javascript without the calling page having to wait for the update page to finish? Basically, I think the update page needs to use: ignore_user_abort(1); set_time_limit(0); // I don't think the script will take more than 1 min. At the other end I found this: 1) http://www.mindraven.com/blog/php/run-a-php-script-in-the-background-using-ajax/ 2) On that page a user suggested using *pclose(popen(‘/usr/bin/php /path/to/something.php /dev/null ’, ‘r’)* **However, I need this to be usable on windows servers also. 3) Finally, would pcntl_exec, pcntl_fork, exec or something be useful for me? Which of the above 3 options is the better one? Other suggestions are welcome :) Thanks and Regards, Ferdi
Re: [PHP] Execute a php page and don't wait for it to finish
A simple AJAX script would do the trick, no? Or does the script which was triggered by JS get aborted if that page is unloaded? If javascript is unavailable you could trigger it through the img tag like so: img width='0' height='0' src=updater.php alt= / Again, not sure if it will keep running if the caller is unloaded. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute a php page and don't wait for it to finish
Ferdi schrieb: Hi List, I have a php page that updates data from one database to another when it is run. My query is, how can I trigger the execution of this update page from another php / javascript without the calling page having to wait for the update page to finish? Basically, I think the update page needs to use: ignore_user_abort(1); set_time_limit(0); // I don't think the script will take more than 1 min. At the other end I found this: 1) http://www.mindraven.com/blog/php/run-a-php-script-in-the-background-using-ajax/ 2) On that page a user suggested using *pclose(popen(‘/usr/bin/php /path/to/something.php /dev/null ’, ‘r’)* **However, I need this to be usable on windows servers also. 3) Finally, would pcntl_exec, pcntl_fork, exec or something be useful for me? Which of the above 3 options is the better one? Other suggestions are welcome :) Thanks and Regards, Ferdi 1) I guess an asynchronous ajax request is what you are looking for. But it won't work on command line. 2) Maybe http://robert.accettura.com/blog/2006/09/14/asynchronous-processing-with-php/ could help you, but I never tried that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Execute a php page and don't wait for it to finish
-Original Message- From: Sebastian Detert [mailto:php-maill...@elygor.de] Sent: Tuesday, October 19, 2010 6:51 AM To: Ferdi; PHP General Subject: Re: [PHP] Execute a php page and don't wait for it to finish Ferdi schrieb: Hi List, I have a php page that updates data from one database to another when it is run. My query is, how can I trigger the execution of this update page from another php / javascript without the calling page having to wait for the update page to finish? Basically, I think the update page needs to use: ignore_user_abort(1); set_time_limit(0); // I don't think the script will take more than 1 min. At the other end I found this: 1) http://www.mindraven.com/blog/php/run-a-php-script-in-the- background-u sing-ajax/ 2) On that page a user suggested using *pclose(popen('/usr/bin/php /path/to/something.php /dev/null ', 'r')* **However, I need this to be usable on windows servers also. 3) Finally, would pcntl_exec, pcntl_fork, exec or something be useful for me? Which of the above 3 options is the better one? Other suggestions are welcome :) Thanks and Regards, Ferdi 1) I guess an asynchronous ajax request is what you are looking for. But it won't work on command line. 2) Maybe http://robert.accettura.com/blog/2006/09/14/asynchronous-processing- with-php/ could help you, but I never tried that. What about having the script flags a field in the DB and have another script running as daemon either via cron or Windows Service/Scheduler and run the command based on the flag in the DB? This way, you don't have to worry about the security issues of *pclose(popen('/usr/bin/php /path/to/something.php /dev/null ', 'r')* You can also have another page that will flag the DB should the user wish to abort the command. The background script would check this abort flag so often based on your criteria and abort the corresponding command accordingly, especially if some of the command may run for extended period time. Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP execute very slow : PHP Version 5.2.6
have you tried using a profiler like xdebug? or may be it is not a php issue at all.. i find https://addons.mozilla.org/en-US/firefox/addon/1843 to be helpful in these situations -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP execute very slow : PHP Version 5.2.6
On 4/10/2010 9:07 PM, Kristijan Marin wrote: Hi, I'm experiencing very slow performance of my php scripts ... At first and for a long time I thought it was Oracle fault cause I didn't use binding (I rewrote the code ), but the performance is still bad. So I tested my sql statement and did some time measurement and found out that Oracle can fetch 300 records in less then 2 seconds, but PHP needs 210seconds ... to display it to the user I'm using default php.ini I have a horizontal menu with buttons to switch pages . and just switching pages takes time with minimum or no oracle interactions. My php version: 5.2.6 OS: Windows XP sP3 and Windows Server 2008 Testing it in PHPEd using internal PHPEd server and FastCGI ... and also on Windows 2008 server in IIS ...same results both using the same php.ini Would anyone know what could be the cause of this ? Any hit is appreciated. Kris Use microtime() and record execution times at various points in your script. Save the times and its corresponding script line number in a string, with suitable formating br /s etc. At the end of the script, echo it. Incidentally, are you echo-ing output to the client as the info is available, or using output buffering? Will make big difference if you are sending a lot of output pieces. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute flash files with PHP
Hello. I have two scripts in php that reads a .swf or .flv movie file, like this: SCRIPT # 1 ?php $movie = movie.swf; readfile($movie); ? SCRIPT # 2 ?php $movie = movie.flv; readfile($movie); ? The script # 1 with the .swf file works fine: the video is executed with streaming. The script # 2 with the .flv file is executed but without streaming. If i execute the movie.flv directly (without the php script), then it´s executed with streaming. Do you know how can i do to execute the .flv file with php and with straming? I tried with fopen, readfile, but don´t works. Thank you
Re: [PHP] Execute flash files with PHP
R B wrote: Hello. I have two scripts in php that reads a .swf or .flv movie file, like this: SCRIPT # 1 ?php $movie = movie.swf; readfile($movie); ? SCRIPT # 2 ?php $movie = movie.flv; readfile($movie); ? The script # 1 with the .swf file works fine: the video is executed with streaming. The script # 2 with the .flv file is executed but without streaming. If i execute the movie.flv directly (without the php script), then it´s executed with streaming. If you change the filetype (from swf to flv) you need to change the headers php sends before it spits out the file. What headers are you sending? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute flash files with PHP
R B wrote: Hello. I have two scripts in php that reads a .swf or .flv movie file, like this: SCRIPT # 1 ?php $movie = movie.swf; readfile($movie); ? SCRIPT # 2 ?php $movie = movie.flv; readfile($movie); ? The script # 1 with the .swf file works fine: the video is executed with streaming. The script # 2 with the .flv file is executed but without streaming. There's a tutorial here: http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two (have not tested it myself). The php code is available for download from that page as well. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute flash files with PHP
There's a tutorial here: http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two (have not tested it myself). The php code is available for download from that page as well. And the video there is awesome! The narrator sounds like the one in my video: http://webbytedd.com/bb/ice/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute EXE with variables
2009/2/13 Dan Shirah mrsqua...@gmail.com: Use the system() command, and enclose both your command and its parameters in a pair of single quotes, as: system('mycmd -a alfa -b bravo'); Paul -- Paul M. Foster Using both exec() and system() I am getting the error: Unable to fork This sounds to me like it is an restriction on the server that doesn't allow php to fork so it could start another process. Maybe you should ask your hoster if you are not allowed to do this. -- Currently developing a browsergame... http://www.p-game.de Trade - Expand - Fight Follow me at twitter! http://twitter.com/moortier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute EXE with variables
Yannick Mortier wrote: 2009/2/13 Dan Shirah mrsqua...@gmail.com: Using both exec() and system() I am getting the error: Unable to fork This sounds to me like it is an restriction on the server that doesn't allow php to fork so it could start another process. Maybe you should ask your hoster if you are not allowed to do this. LOL - reminds me of a host I used that did not allow php to call exec() So what I did was put the command into a database and had cron once a minute pop the database and run any commands it had in it. After a week I got an e-mail notifying me my cron privileges had been revoked. So I went to a different host. I don't remember what it was I was doing, but I do remember I later found a php module that allowed me to do it all in pure php (something image processing related). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute EXE with variables
Hi, I've had a lot of problems with shell_exec too. Mostly it was permissions or environment variables not being set. i dont know if there is a way to set environment variables in the php.ini but if not you can set them with shell_exec as well, at least on unix it works. You can simply concatenate the commands necessary with a colon (;) inbetween. Maybe you can have multiple shell_exec commands and it stays in the same env. Not sure about this though. Please someone enlighten us on this... Hope some of this helped. Regards, Tim Tim-Hinnerk Heuer http://www.ihostnz.com Jay London - My father would take me to the playground, and put me on mood swings. 2009/2/14 Dan Shirah mrsqua...@gmail.com Use the system() command, and enclose both your command and its parameters in a pair of single quotes, as: system('mycmd -a alfa -b bravo'); Paul -- Paul M. Foster Using both exec() and system() I am getting the error: Unable to fork
Re: [PHP] Execute EXE with variables
On Sun, 2009-02-15 at 00:16 +1300, German Geek wrote: Hi, I've had a lot of problems with shell_exec too. Mostly it was permissions or environment variables not being set. i dont know if there is a way to set environment variables in the php.ini but if not you can set them with shell_exec as well, at least on unix it works. You can simply concatenate the commands necessary with a colon (;) inbetween. Maybe you can have multiple shell_exec commands and it stays in the same env. Not sure about this though. Please someone enlighten us on this... Hope some of this helped. Regards, Tim Tim-Hinnerk Heuer http://www.ihostnz.com Jay London - My father would take me to the playground, and put me on mood swings. 2009/2/14 Dan Shirah mrsqua...@gmail.com Use the system() command, and enclose both your command and its parameters in a pair of single quotes, as: system('mycmd -a alfa -b bravo'); Paul -- Paul M. Foster Using both exec() and system() I am getting the error: Unable to fork I use the exec() function regularly and have no troubles passing more than one argument to it. Admittedly, I've not tried this on a Windows system, just a Linux one, and I was using exec() to call a Bash script, which should behave like an exe I guess. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute EXE with variables
Hello all, Can someone point me in the right direction? I'm trying to call an EXE from PHP and pass it two variables. I looked at the exec() command and I see that this can call the executable, but I don't see that it can pass the variables to it. Dan
Re: [PHP] Execute EXE with variables
On Fri, Feb 13, 2009 at 02:30:38PM -0500, Dan Shirah wrote: Hello all, Can someone point me in the right direction? I'm trying to call an EXE from PHP and pass it two variables. I looked at the exec() command and I see that this can call the executable, but I don't see that it can pass the variables to it. Use the system() command, and enclose both your command and its parameters in a pair of single quotes, as: system('mycmd -a alfa -b bravo'); Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute EXE with variables
Use the system() command, and enclose both your command and its parameters in a pair of single quotes, as: system('mycmd -a alfa -b bravo'); Paul -- Paul M. Foster Using both exec() and system() I am getting the error: Unable to fork
Re: [PHP] Execute command line as a different user
On Tue, Jul 1, 2008 at 1:17 PM, Matt palermo [EMAIL PROTECTED] wrote: My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? You can always create a script and have crond handle it running as the admin user, if you're on *NIX. Otherwise, check into the Winblows command `AT`. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute command line as a different user
My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute command line as a different user
On Tue, Jul 1, 2008 at 1:17 PM, Matt palermo [EMAIL PROTECTED] wrote: My PHP is running as a user with limited rights. I'd like to execute a command line as a different user. I'm trying to delete a file and the PHP user doesn't have access to do this. I know the username and password for the admin user that has rights to delete a file. Is there a command I can use to make PHP run a delete command as the admin user? If so, how can I do this? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I did a quick check on php.net, there is a post on there that talks about using sudo: @exec(echo 'apache' | /usr/bin/sudo -u mail -S /var/www/html/mailset.sh $name); You may want to read thru it, php.net/exec, go to the user notes. -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
[PHP] Execute php commands that are in an array
Hey, its easier to start with code and then explain: $t_array[]='chr(rand(97,122))'; echo $t_array[0]; The above code outputs chr(rand(97,122)) How can i execute that above code from the array instead of displaying it? Thanks! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute php commands that are in an array
On Thu, Jun 5, 2008 at 12:34 PM, Ryan S [EMAIL PROTECTED] wrote: Hey, its easier to start with code and then explain: $t_array[]='chr(rand(97,122))'; echo $t_array[0]; The above code outputs chr(rand(97,122)) How can i execute that above code from the array instead of displaying it? Try using create_function(). ?php $t_array[] = create_function('','echo chr(rand(97,122));'); echo $t_array[0]; ? Note the manner in which the second parameter is laid-out. You must include what you want returned by the dynamic function, complete with an ending semicolon. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Execute php commands that are in an array
I'm not sure I understand what you're trying to accomplish, but wouldn't array_walk() help you out? Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: Daniel Brown [mailto:[EMAIL PROTECTED] Enviada em: quinta-feira, 5 de junho de 2008 14:18 Para: Ryan S Cc: php php Assunto: Re: [PHP] Execute php commands that are in an array On Thu, Jun 5, 2008 at 12:34 PM, Ryan S [EMAIL PROTECTED] wrote: Hey, its easier to start with code and then explain: $t_array[]='chr(rand(97,122))'; echo $t_array[0]; The above code outputs chr(rand(97,122)) How can i execute that above code from the array instead of displaying it? Try using create_function(). ?php $t_array[] = create_function('','echo chr(rand(97,122));'); echo $t_array[0]; ? Note the manner in which the second parameter is laid-out. You must include what you want returned by the dynamic function, complete with an ending semicolon. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute command from web browser
Well, you're missing a semi-colin after the exec() statement, and the echo. If it wasn't the syntax error, make sure the program exists with file_exists(); - Craige On Sat, May 3, 2008 at 11:28 PM, [EMAIL PROTECTED] wrote: Hi all I try write a code to execute service in my server from web browser I write next /var/www/html/squidup.html ? exec ('/usr/bin/squid/sbin/squid') echo Squid UP ? but, don't work from web browser. What is wrong Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute command from web browser
Hi all I try write a code to execute service in my server from web browser I write next /var/www/html/squidup.html ? exec ('/usr/bin/squid/sbin/squid') echo Squid UP ? but, don't work from web browser. What is wrong Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute command from web browser
On 5/3/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all I try write a code to execute service in my server from web browser I write next /var/www/html/squidup.html Should it be... squidup.php? ? exec ('/usr/bin/squid/sbin/squid') echo Squid UP ? but, don't work from web browser. What is wrong Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute a script from command line on a Linux system with Plesk (safe mode)
Hello, I am trying to execute this script (from command line): function getMailboxSize($domain, $mailbox){ // Maildirectories are stored under /var/qmail(mailnames/domain/mailuser $path = /var/qmail/mailnames/ . $domain . / . $mailbox; $size = shell_exec(cd . $path . ;du -bc * | grep total | cut -d\\t -f 0,1); return trim($size); } I get the warning: shell_exec(): Cannot execute using backquotes in Safe Mode. Ok, I don't want to modify to suphp or so... what other alternatives do I have? Shall I put this code in a shell script, sudo it and let it execute by my php script? Or how can I get around? I have also tried to connect via mysql in order to get the usage/limitation with the imap_get_quotaroot function... I used this code: function getMailboxSize($domain, $mailbox, $passwd){ $mbox = imap_open({my_server_ip:993/imap/ssl/novalidate-cert}, $mailbox.@.$domain, $passwd, OP_HALFOPEN) or die(can't connect: . imap_last_error()); $size = 0; $quota = imap_get_quotaroot($mbox, INBOX); if( $quota != FALSE is_array($quota) ){ print_r($quota); }else{ echo no quota?\n; } imap_close($mbox); return $size; } imap_get_quotaroot returns false. I don't know really what else I could try... The goal is to get the usage of each imap mailbox on the machine (used/quota) to know if it is full or not (if not, how full?). Would be nice if someone could help :) LS -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute a script from command line on a Linux system with Plesk (safe mode) [solved]
Hello, I found it myself... I just start php in command line with --php-ini other_php.ini where I set safe_mode Off. Bye :) -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php execute command on server
On Mon, May 28, 2007 6:02 pm, Jody Gugelhupf wrote: vlc command itself executed on my machine from the console shows that the command works fine, this probably means that somehting is wrong with my php file. Not necessarily all that useful... PHP runs as a different user in a different environment than you do in your logged in shell. su to the PHP User and try running the vlc thingie. the second command opens the vlc stream from the server, which works fine too anyhow back to the first command the vlc stream server executer, i can see it in the list of the running processes on my machine, but the stream does not work, i don't know why, either there is somehting wrong with my php: ?php // outputs the username that owns the running php/httpd process // (on a system with the whoami executable in the path) echo system('vlc v4l:/dev/video0:norm=pal:frequency=767250:size=320x240:channel=0:adev=/dev/dsp:audio=0 --sout \'#transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=256,vt=80,keyint=80,deinterlace=blend}:std{access=http,mux=ts,url=10.0.0.1:8082}\' --ttl 12 -I dummy'); ? or does the www-data (apache) user needs special user permissions to access the devices /dev/video0 /dev/dsp ? i have no clue, is there a way to see some output? thx for the help :) Use http://php.net/exec and check the error codes returned. Almost for sure, yes, the PHP user needs to be added to whatever group has access to those devices. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php execute command on server
hi ppl :) i run apache 2 on ubuntu feisty with php 5, i have website on which i have 2 links, the first is a php which should start a vlc stream server on my server (see below), streaming from my tvcard, the vlc command itself executed on my machine from the console shows that the command works fine, this probably means that somehting is wrong with my php file. the second command opens the vlc stream from the server, which works fine too anyhow back to the first command the vlc stream server executer, i can see it in the list of the running processes on my machine, but the stream does not work, i don't know why, either there is somehting wrong with my php: ?php // outputs the username that owns the running php/httpd process // (on a system with the whoami executable in the path) echo system('vlc v4l:/dev/video0:norm=pal:frequency=767250:size=320x240:channel=0:adev=/dev/dsp:audio=0 --sout \'#transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=256,vt=80,keyint=80,deinterlace=blend}:std{access=http,mux=ts,url=10.0.0.1:8082}\' --ttl 12 -I dummy'); ? or does the www-data (apache) user needs special user permissions to access the devices /dev/video0 /dev/dsp ? i have no clue, is there a way to see some output? thx for the help :) katie Get news delivered with the All new Yahoo! Mail. Enjoy RSS feeds right on your Mail page. Start today at http://mrd.mail.yahoo.com/try_beta?.intl=ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php execute command on server
On 5/28/07, Jody Gugelhupf [EMAIL PROTECTED] wrote: or does the www-data (apache) user needs special user permissions to access the devices /dev/video0 /dev/dsp ? i have no clue, is there a way to see some output? thx for the help :) You can become the user you want to test permissions for: sudo su - su - www-data On my Feisty install the www-data user does not have the permissions you require. cat /dev/dsp cat: /dev/dsp: Permission denied To access /dev/dsp the www-data user needs to be a member of the audio group. You can use usermod to add the audio group to the www-data user: usermod -G www-data,audio www-data After this I begin to get output from /dev/dsp as the www-data user. Hope that help. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute script and redirect
Best groupmember, I have a form that is being filled out. This is the process: 1. Fill out form and click submit 2. Script validates data 3. Data is being sent to external source via Web Service 4. A file is being downloaded (redirects to files location) The problem is that #3 is taking around 15 seconds to complete because the Web Service is very slow. I would like to run #3 in the background and directly jump to #4. Is this possible? A little confused :) /Peter
Re: [PHP] Execute script and redirect
On Thu, April 20, 2006 2:23 am, Peter Lauri wrote: 1.Fill out form and click submit 2.Script validates data 3.Data is being sent to external source via Web Service 4.A file is being downloaded (redirects to files location) The problem is that #3 is taking around 15 seconds to complete because the Web Service is very slow. I would like to run #3 in the background and directly jump to #4. Is this possible? There's possible, and then there's possible... How about this: The BEST solution would be to insert the [valid/clean] data into a database, and run a cron job to send off everything to the Web Service. You'll have to mark what's sent and what isn't and be careful not to run two jobs at once when it's really slow (sending duplicate data) nor to skip data that didn't safely get sent. But should do all that anyway in your script. There might even be functions in the Web Service to make it easy for you to send a whole BUNCH of records at once, saving a lot of time on your end. And, for sure, if all your script has to do is insert to a database table for step 3, it's gonna be pretty fast. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Execute script and redirect
That was a smart solution. However, my client have not given me access to the MySQL database at this stage (just doing a small side project of the clients web site). If you could not take advantage of database and cron job, what would you do? PS! I am not sure that my clients host supports cron jobs DS! -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Thursday, April 20, 2006 2:57 PM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] Execute script and redirect On Thu, April 20, 2006 2:23 am, Peter Lauri wrote: 1.Fill out form and click submit 2.Script validates data 3.Data is being sent to external source via Web Service 4.A file is being downloaded (redirects to files location) The problem is that #3 is taking around 15 seconds to complete because the Web Service is very slow. I would like to run #3 in the background and directly jump to #4. Is this possible? There's possible, and then there's possible... How about this: The BEST solution would be to insert the [valid/clean] data into a database, and run a cron job to send off everything to the Web Service. You'll have to mark what's sent and what isn't and be careful not to run two jobs at once when it's really slow (sending duplicate data) nor to skip data that didn't safely get sent. But should do all that anyway in your script. There might even be functions in the Web Service to make it easy for you to send a whole BUNCH of records at once, saving a lot of time on your end. And, for sure, if all your script has to do is insert to a database table for step 3, it's gonna be pretty fast. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Execute script and redirect
On Thu, April 20, 2006 3:42 am, Peter Lauri wrote: That was a smart solution. However, my client have not given me access to the MySQL database at this stage (just doing a small side project of the clients web site). If you could not take advantage of database and cron job, what would you do? PS! I am not sure that my clients host supports cron jobs DS! At that point, I go to the client and explain why I need cron jobs and database access. We then either go to the host and get it. Or we find a host that will provide it. Or, in extreme cases, I build that side portion of their site on a good host, and provide some kind of API (however crude it may be) so that the functionality appears on their website, even when it's not really on their host. Attempting to fork from exec is an exercise in frustration and version-specific gotchas as well as more than a few generalized gotchas I've done it, and it is possible but it's such a Last Resort, that I wouldn't recommend it. In principle, it's as easy as: ?php $command = send junk off to Web Services shell script $args; exec($command , $output, $error); //This next line is a shameless plug for http://l-i-e.com/perror if (function_exists('strerror')) $error .= . strerror($error); if ($error) error_log(OS Error: $error - $command); ? In practice, depending on the setup of the server and a whole host of conditions I never quite understood, the will or won't work. You can maybe fix that with a shell script of your own that does the but if you don't have shell access, that's pretty much not fun with FTP and test/re-test. Then... I could go on a lot longer, but am going to quit now. You could do without the database by just appending the info into a flat file... You can find work-arounds to the cron problem in many ways -- Sites that surf to your page in a cron-like fashion, running cron elsewhere to hit your own page, etc... I'd go with any of those before trying to fork in a web environment, personally. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute a shell command using thttpd-php
Nelson Carreira wrote: James E Hicks III wrote: Nelson Carreira wrote: Yes, I've tried using both absolute and relative paths. The system output is 0 when I execute, for example, nvram show from the php. From what I know this output means success. Although there's no output on php. Nelson Carreira From your original post it looks like the function you want to use is passthru(). I just noticed the following note on php.net: Note: When safe mode is enabled, you can only execute executables within the safe_mode_exec_dir. For practical reasons it is currently not allowed to have .. components in the path to the executable. Could this be your problem? James This version of php doesn't have a php.ini file for configuration, so there's no safe_mode_exec_dir. I tried to create the one mentioned in php_info() and copy the executables there but it didn't work. Nelson Carreira Hmmm. I'm all out of ideas. James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute a shell command using thttpd-php
Hello, I'm quite new to PHP language and although I got into it pretty fast I'm having some trouble executing system commands using php. I'm using thttpd-php_2.21b-2_mipsel in a Linksys router and I can only execute system commands like ls and cd from the PHP. I tried using the different available functions (exec(), shell_exec(), system(), passthru() and backsticks) but none of them works. I can't even run scripts! I'm working on a web application that will be used to configure the router and I need to use a lot of other commands from the PHP, so right now I'm quite stucked. I tried to find help online and offline but wasn't able to find any. I just hope you guys can help me! Thanks, Nelson Carreira -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute a shell command using thttpd-php
Nelson Carreira wrote: Hello, I'm quite new to PHP language and although I got into it pretty fast I'm having some trouble executing system commands using php. I'm using thttpd-php_2.21b-2_mipsel in a Linksys router and I can only execute system commands like ls and cd from the PHP. I tried using the different available functions (exec(), shell_exec(), system(), passthru() and backsticks) but none of them works. I can't even run scripts! What happens? Do you get an error? The commands you're trying to execute can't be interactive (ie can't prompt for information). They must be run by themselves and possibly display results. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute a program from PHP CLI and allow user interaction
Hi all This one's got me stumped. I'm working on a PHP CLI interface, and I need to allow the user to input a bit of HTML. Rather than bandy around with readline() and the like, I thought it would be nice to just create a temporary file, pop nano up, and read and then delete the file once it's been edited. That way I get nano's syntax highlighting and other useful features. However, I can't for the life of me figure out how to allow the user to interact with nano once the process has been launched. The usual culprits: {exec,system,shell_exec}( nano tmpfile.txt ); all just hang (top shows nano is running, but it doesn't seem to be attached to the terminal). How can I launch a process and attach it to the terminal PHP CLI was launched from so that the user can interact with it? TIA -- Jasper Bryant-Greene General Manager Album Limited +64 21 708 334 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute appliction and pass parameters to it!
Hi, I am trying to execute one application (bat file) and need to pass parameter to it. I want to put this into wrapper file which i can call over http. Can i do this? I tried the following: -- 1) $output = shell_exec('..\phpunit.bat C:\Run.php'); echo $output; Result: No output. Nothing happened. 2) $cmd = '..\..\phpunit.bat'; // Setup an array of arguments to be sent. $arg[] = ..\..\Run.php; // Pick a place for the temp_file to be placed. $outputfile = '..\..\CMDOUT.txt'; // Setup the command to run from run $cmdline = cmd /C $cmd . implode(' ', $arg) ; try { echo Came in try; $WshShell = new COM(WScript.Shell); $oExec = $WshShell-Run($cmdline, 3, true); echo $oExec; // This is not getting printed. echo Coming out of try; } catch(Exception $e) { echo came in catch; print(Caught Exception in . $e-file() . on line . $e-line() . br\n); } Result: Nothing is happening. It is printing both the statements in the try block. 3) $firstArg = C:\\..\\..\\Run.php; $output = exec(C:\\..\\..\\phpunit.bat $firstArg); Result: Still nothing is happening. 4)$output = exec(C:\\..\\..\\phpunit.bat $firstArg 21, $myOut); echo br/My out value is .$myOut; Result: My out value is Array operable program or batch file. -- All the above approaches not working for me. Can somebody inform me where i need to make changes. Thanks in advance. Regards, Dipesh
Re: [PHP] Execute appliction and pass parameters to it!
On Tue, March 29, 2005 10:38 am, Dipesh Khakhkhar said: -- 1) $output = shell_exec('..\phpunit.bat C:\Run.php'); echo $output; Change shell_exec to exec, and use the extra parameters to get back ERROR MESSAGES and ERROR CODE. Print those out, and Windoze should tell you what's wrong. Don't use '..\phpunit.bat' -- Use a full pathname. Also don't use \ at all, I don't think... I *think* PHP will convert / to the right thing for your OS. No promises on that part. If you *DO* use \, you should use \\, even inside '', just case your filename ever has a ' in it or you ever need to use variables, switch to , and suddenly it doesn't work because now \n isn't what it once was. 3) $firstArg = C:\\..\\..\\Run.php; $output = exec(C:\\..\\..\\phpunit.bat $firstArg); Result: Still nothing is happening. 4)$output = exec(C:\\..\\..\\phpunit.bat $firstArg 21, $myOut); echo br/My out value is .$myOut; Result: My out value is Array operable program or batch file. echo br /My out value is , implode(, $myOut); Also add $myError argument, and do: if ($myError) echo OS Error: $myErrorbr /\n; -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute methods dynamically
Hello everybody, I want to write a method in version 4 that executes a method of an object. As parameter the classname and the methodname is passed: function executeMethod($classname, $methodname) { $object = new $classname(); $object-$methodname(); } This does not work. What am I doing wrong? Greetings, -Rainer Hahnekamp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute shell script from PHP
shell_exec() Tom Khan wrote: Hello, I have a shell script for ading users to LDAP. It looks like this: #!/bin/bash MUID=userlogin FULLNAME=First Last LASTNAME=Last DOMAIN=example.org SERVER=qmail.example.org PASS=userpass cat .ldif.tmp.$MUID EOF dn: uid=$MUID,ou=accounts,dc=example,dc=org cn: $FULLNAME sn: $LASTNAME objectclass: top objectclass: person objectclass: inetOrgPerson objectclass: qmailUser mail: [EMAIL PROTECTED] mailhost: $DOMAIN mailMessageStore: /var/qmail/maildirs/$MUID/Maildir userPassword: $PASS uid: $MUID accountStatus: enabled EOF ldapadd -x -v -w secret -D cn=Manager,dc=example,dc=org \ -f .ldif.tmp.$MUID rm .ldif.tmp.$MUID How Can I run (trigger) this script from PHP so I could create web form for adding users. TNX -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute shell script from PHP
Tom wrote: shell_exec() yes, I have try that but nothing happenes. here is my code. Is this correct? ?php shell_exec('/test/acct.sh'); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute shell script from PHP
Khan wrote: Tom wrote: shell_exec() yes, I have try that but nothing happenes. here is my code. Is this correct? ?php shell_exec('/test/acct.sh'); ? looks fine to me, except that I tend to run a check to make sure that it has run ok, like $myReturn = shell_exec('/test/acct.sh'); or if (shell_exec('/test/acct.sh'); On some systems you have to execute the script eg $myReturn = shell_exec('. /test/acct.sh'); Also make sure that the acct.sh script is executable by the php user (chmod / chown are your evil friends :) ) Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute shell script from PHP
On Tuesday 18 January 2005 18:59, Tom wrote: Khan wrote: Tom wrote: shell_exec() yes, I have try that but nothing happenes. here is my code. Is this correct? ?php shell_exec('/test/acct.sh'); ? Note that shell_exec() expects a filesystem path and not your webserver's document root. looks fine to me, except that I tend to run a check to make sure that it has run ok, like $myReturn = shell_exec('/test/acct.sh'); or if (shell_exec('/test/acct.sh'); Note also that if command executes correctly without error then 0 is returned and non-zero in case of errors. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute shell script from PHP
Hello, I have a shell script for ading users to LDAP. It looks like this: #!/bin/bash MUID=userlogin FULLNAME=First Last LASTNAME=Last DOMAIN=example.org SERVER=qmail.example.org PASS=userpass cat .ldif.tmp.$MUID EOF dn: uid=$MUID,ou=accounts,dc=example,dc=org cn: $FULLNAME sn: $LASTNAME objectclass: top objectclass: person objectclass: inetOrgPerson objectclass: qmailUser mail: [EMAIL PROTECTED] mailhost: $DOMAIN mailMessageStore: /var/qmail/maildirs/$MUID/Maildir userPassword: $PASS uid: $MUID accountStatus: enabled EOF ldapadd -x -v -w secret -D cn=Manager,dc=example,dc=org \ -f .ldif.tmp.$MUID rm .ldif.tmp.$MUID How Can I run (trigger) this script from PHP so I could create web form for adding users. TNX -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute a scipt in the background
I want to start the execution of a script in the background at the time of user login. In the script there is infinite loop which is checking something after every 10 seconds and if it get true value the it open a popup window on the brower and if the user session expires then it terminate the script. how can I acheive this ? I have tried to do this by putting the script path in the img tag in th src parameter but its not working. Is there any way of executing a file by means of writing a command in the php script. Please help it's urgent. Narender Rauthan [EMAIL PROTECTED]
Re: [PHP] Execute a scipt in the background
On Thu, 17 Jun 2004 11:59:45 +0530, narender [EMAIL PROTECTED] wrote: I want to start the execution of a script in the background at the time of user login. In the script there is infinite loop which is checking something after every 10 seconds and if it get true value the it open a popup window on the brower and if the user session expires then it terminate the script. how can I acheive this ? I have tried to do this by putting the script path in the img tag in th src parameter but its not working. Is there any way of executing a file by means of writing a command in the php script. You *may* be able to start a script in the background, but once the first request to the webserver finishes, you can't interact with the file again. I would say do the check on every page load and popup your popup then. You could also add some JS to make a call back to the webserver (via a hidden iframe) to check to see if it should popup. You could also run a PHP script from cron that writes a file (to /tmp, say) that lets a request know when to popup. On every request, you check for the file and popup if it's there. I definate;y do not suggest this one. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute script via email?
Is there a way for me to email this script so it executes the close of a round instead of doing it from the website administration . (it is a football tipping script) ?php include(connect.php); // Grab variables and insert into database $x=1; $Round = $_POST['Round']; switch ($Round) { case QF: $y = 5; break; case SF: case PF: $y = 3; break; case GF: $y = 2; break; default: $y = 9; break; } While ($x $y) { $Game = $x; $sql = mysql_query(UPDATE Rounds SET Closed = 'Yes' WHERE Round = '$Round' AND Game = '$Game'); $x++; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] execute script via email?
Sure... You can write a small php script that uses PHP's imap or pop functions to monitor any email address. (Check out http://us3.php.net/manual/en/ref.imap.php for details.) Once that's written, just schedule it as a task using the windows scheduler or cron in unix/linux. -- jon --- jon roig web developer email: [EMAIL PROTECTED] phone: 888.230.7557 -Original Message- From: BigMark [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 6:27 AM To: [EMAIL PROTECTED] Subject: [PHP] execute script via email? Is there a way for me to email this script so it executes the close of a round instead of doing it from the website administration . (it is a football tipping script) ?php include(connect.php); // Grab variables and insert into database $x=1; $Round = $_POST['Round']; switch ($Round) { case QF: $y = 5; break; case SF: case PF: $y = 3; break; case GF: $y = 2; break; default: $y = 9; break; } While ($x $y) { $Game = $x; $sql = mysql_query(UPDATE Rounds SET Closed = 'Yes' WHERE Round = '$Round' AND Game = '$Game'); $x++; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute php script with crontab
Sorry, for delayed reply, but anyway thanks for your help and your sugestions to check the cron log, after read the tutorial and do some actions (trial and error) for a days, finally i found i know it what's going on, the tutorial say that there is two way to run php script with cron : 1. First by using cgi compile the php code into binary file use the path of the file /usr/bin/php -q /var/www/html/sampel.php, or 2. use lynx http://server.com/sample.php and when i try the step one there is an error like this : PHP Warning: Unable to load dynamic library '/usr/lib/php4/gd.so' - /usr/lib/php4/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0 is that somebody know this problem and how to solve it... because i fail in the first way, so i use the second way and the script works... and the first step still make me confused what's going on...?? does any one have the idea??? Developer [EMAIL PROTECTED] wrote: Could I add a question regarding the cron command? If you automatically run a php script through the cron command is timeout taken under account or does it run through the command line which is faster (and timeout is not taken under account?) Thanks all Mario yup, i don't know exacly about your questions but i think your questions is about the user account who run the script in the cron, but i use this line to run my script from the cron, is that like this.. * * * * * lynx http://server.com/sample.php /dev/null the other tutorial give a sample like this : 1 * * * * root /usr/bin/php /var/www/html/cron/testcron.php after trial and error i deside to use the first line and works, but i am did'nt check the execution time. and i think i got to learn about cron. Thanks for all help. linux is mystery so i have to explore idur - Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
Re: [PHP] execute php script with crontab
Could I add a question regarding the cron command? If you automatically run a php script through the cron command is timeout taken under account or does it run through the command line which is faster (and timeout is not taken under account?) Thanks all Mario - Original Message - From: rudi [EMAIL PROTECTED] To: Jason Wong [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, January 19, 2004 7:29 AM Subject: Re: [PHP] execute php script with crontab Ok, thanks i will check it first. soon i will send mail about it. Jason Wong [EMAIL PROTECTED] wrote:On Monday 19 January 2004 12:01, rudi wrote: 01 * * * * root run-parts /usr/bin/php /var/www/html/cron/testcron.php I believe 'run-parts' takes a directory as argument. Try: 1 * * * * root /usr/bin/php /var/www/html/cron/testcron.php Also if you have: #!/usr/bin/php as the first line in testcron.php (and make it executable) then you can use simply: 1 * * * * /var/www/html/cron/testcron.php -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* However the modem comes set from the factory, it will be the WRONG way to work on your machine -- Murphy's Laws of BBS'ing n3 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute php script with crontab
On Monday 19 January 2004 21:14, Developer wrote: Could I add a question regarding the cron command? If you automatically run a php script through the cron command is timeout taken under account or does it run through the command line which is faster (and timeout is not taken under account?) Which timeout? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* QOTD: Sure, I turned down a drink once. Didn't understand the question. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute php script with crontab
Hi There, I am a new be in php programming ussually i using php under windows, but now i am migrate to linux. I have php script to write time (testcron.php owner apache chmod 775) into file testcron.txt(owner apache chmod 775), and i want this script running from crontab. My problem is how to execute my script with cron. i know this question it's sound dumbs.. but i have try it and fail may be somebody can help me.. This is my php script just for checking cron, i am using apache web server in linux redhat 7.3 the other tutorial say that i have to compile my php script so the cron can execute my script, but how to compile it and i don't have cgi. ? $waktu=date(l-j-F-Y H:i:s); $jelaskan=Waktu test cron terbaru; $filename_count = testcron.txt; $fcount = fopen ($filename_count, w) or die(Couldn't open $filename); fwrite ($fcount, $jelaskan --- $waktu\n); fclose($fcount); ? I have try to added my script in crontab, like this : [EMAIL PROTECTED] root]# cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts #01 * * * * root run-parts /etc/cron.hourly #02 4 * * * root run-parts /etc/cron.daily 01 * * * * root run-parts /usr/bin/php /var/www/html/cron/testcron.php #22 4 * * 0 root run-parts /etc/cron.weekly #42 4 1 * * root run-parts /etc/cron.monthly There must be something wrong, i don't know what...???, coz this script did not write anything to a file testcron.txt Please Tell me WHAT should i do, step by step to setting up this script with crontab. Thanks for all help. idur - Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
Re: [PHP] execute php script with crontab
On Sun, 2004-01-18 at 23:01, rudi wrote: Hi There, I am a new be in php programming ussually i using php under windows, but now i am migrate to linux. I have php script to write time (testcron.php owner apache chmod 775) into file testcron.txt(owner apache chmod 775), and i want this script running from crontab. My problem is how to execute my script with cron. i know this question it's sound dumbs.. but i have try it and fail may be somebody can help me.. This is my php script just for checking cron, i am using apache web server in linux redhat 7.3 the other tutorial say that i have to compile my php script so the cron can execute my script, but how to compile it and i don't have cgi. ? $waktu=date(l-j-F-Y H:i:s); $jelaskan=Waktu test cron terbaru; $filename_count = testcron.txt; $fcount = fopen ($filename_count, w) or die(Couldn't open $filename); fwrite ($fcount, $jelaskan --- $waktu\n); fclose($fcount); ? I have try to added my script in crontab, like this : [EMAIL PROTECTED] root]# cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts #01 * * * * root run-parts /etc/cron.hourly #02 4 * * * root run-parts /etc/cron.daily 01 * * * * root run-parts /usr/bin/php /var/www/html/cron/testcron.php #22 4 * * 0 root run-parts /etc/cron.weekly #42 4 1 * * root run-parts /etc/cron.monthly There must be something wrong, i don't know what...???, coz this script did not write anything to a file testcron.txt Please Tell me WHAT should i do, step by step to setting up this script with crontab. Thanks for all help. idur Double check your file path. You may want to use an absolute path. You might also try firing an error or an email to yourself at the beginning of your script to see if the script is actually running. Check your cron logs also. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute php script with crontab
On Monday 19 January 2004 12:01, rudi wrote: 01 * * * * root run-parts /usr/bin/php /var/www/html/cron/testcron.php I believe 'run-parts' takes a directory as argument. Try: 1 * * * * root /usr/bin/php /var/www/html/cron/testcron.php Also if you have: #!/usr/bin/php as the first line in testcron.php (and make it executable) then you can use simply: 1 * * * * /var/www/html/cron/testcron.php -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* However the modem comes set from the factory, it will be the WRONG way to work on your machine -- Murphy's Laws of BBS'ing n3 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute php script with crontab
Ok, thanks i will check it first. soon i will send mail about it. Jason Wong [EMAIL PROTECTED] wrote:On Monday 19 January 2004 12:01, rudi wrote: 01 * * * * root run-parts /usr/bin/php /var/www/html/cron/testcron.php I believe 'run-parts' takes a directory as argument. Try: 1 * * * * root /usr/bin/php /var/www/html/cron/testcron.php Also if you have: #!/usr/bin/php as the first line in testcron.php (and make it executable) then you can use simply: 1 * * * * /var/www/html/cron/testcron.php -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* However the modem comes set from the factory, it will be the WRONG way to work on your machine -- Murphy's Laws of BBS'ing n3 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
[PHP] Execute a linux binary that generates a registration code...
Hello I have got an app wherein you need to pass a name as the first parameter and it will output that is cout a registraion code for my app based on the name. I would like to give a web based interface wherein a user can give his name on the form and I will be able to generate the code from PHP. I tried the commands - exec(), shell_exec() but none seems to getting the output. in the shell i execute it as - ./appname karam the output is something like a223asas2323 ? How can i get the output. any ideas.. thanks in advance.. Karam __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute a linux binary that generates a registration code...
See www.php.net/passthru Karam Chand wrote: Hello I have got an app wherein you need to pass a name as the first parameter and it will output that is cout a registraion code for my app based on the name. I would like to give a web based interface wherein a user can give his name on the form and I will be able to generate the code from PHP. I tried the commands - exec(), shell_exec() but none seems to getting the output. in the shell i execute it as - ./appname karam the output is something like a223asas2323 ? How can i get the output. any ideas.. thanks in advance.. Karam __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute programs
How do i execute a program and leave it running and while it is running the php-script is still continued and outputs HTML when the other program is still running. I need that is works on windows. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute programs
Bas wrote: How do i execute a program and leave it running and while it is running the php-script is still continued and outputs HTML when the other program is still running. I need that is works on windows. Oh, ohmanual http://www.php.net/manual/en/ref.exec.php -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute programs
John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Bas wrote: How do i execute a program and leave it running and while it is running the php-script is still continued and outputs HTML when the other program is still running. I need that is works on windows. Oh, ohmanual http://www.php.net/manual/en/ref.exec.php -- By-Tor.com It's all about the Rush http://www.by-tor.com I've read the manual, but it says this: Note: If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute programs
Bas wrote: John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Bas wrote: How do i execute a program and leave it running and while it is running the php-script is still continued and outputs HTML when the other program is still running. I need that is works on windows. Oh, ohmanual http://www.php.net/manual/en/ref.exec.php I've read the manual, but it says this: Note: If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends. Okay, so what's wrong with that? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute programs
- Original Message - If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends. Use system() and background it with : $cmd = tail -f /var/log/messages ; system($cmd); -eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute Background Process
apur kurub ver.1 wrote: dear all i will execute background process like $program is there posible in php to process that statement? and return to php immediately; http://www.php.net/system -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com --- Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute Background Process
dear all i will execute background process like $program is there posible in php to process that statement? and return to php immediately; --- rgds [xm] http://ilkomerz36.blogspot.com http://geocities.com/amadarum -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] execute command line script from browser
[snip] Is there a way to execute a command line php script from a browser by, say clicking a button and then having the browser let go and let the script run independet of the browser? Hope I explained that correctly. [/snip] You could invoke the CLI using an exec() http://www.php.net/exec HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute command line script from browser
Is there a way to execute a command line php script from a browser by, say clicking a button and then having the browser let go and let the script run independet of the browser? Hope I explained that correctly. Thanks, Rod CinchHost.com - Web Hosting Made Easier ASP, PHP, CGI, WEBMAIL, And More Packages as Low as $9.99 - No Set Up fees http://www.cinchhost.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute a command
How to execute a command capturing the stanndard error, in addition to standard output? example: echo system('/bin/rm ...'); I need to know when this command fails, and when it fails, i need to know why. Any hints? _Mattia_ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute a command
On 22-Jun-2003 Mattia wrote: How to execute a command capturing the stanndard error, in addition to standard output? example: echo system('/bin/rm ...'); I need to know when this command fails, and when it fails, i need to know why. Any hints? _Mattia_ $cmd='/bin/rm foo'; exec($cmd 21, $output); -- or -- exec($cmd, $output, $errno); echo posix_strerror($errno); -- or -- proc_open(...) and read from pipe[2] Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Execute command which has root privileges
Probably you should look over here for info about suexec http://httpd.apache.org/docs/suexec.html, or check the 'sudo' man pages... With that you could gain root privilages.. -Oorspronkelijk bericht- Van: vijaypatel [mailto:[EMAIL PROTECTED] Verzonden: maandag 9 juni 2003 6:06 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Execute command which has root privileges Hello, I am using FreeBSD 4.7 ,PHP 4.2.3 Apache 1.3 I want to execute shell script which contains few IPFW commands. I have tried with system(),exec(),passthru() command to execute script but i can't do that. Apache has created www user on FreeBSD. I found that www user has not privilege for IPFW. How can i execute script which contains IPFW commands with PHP? I have given 777 permission to script file. Thanking You. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute command which has root privileges
Hello, I am using FreeBSD 4.7 ,PHP 4.2.3 Apache 1.3 I want to execute shell script which contains few IPFW commands. I have tried with system(),exec(),passthru() command to execute script but i can't do that. Apache has created www user on FreeBSD. I found that www user has not privilege for IPFW. How can i execute script which contains IPFW commands with PHP? I have given 777 permission to script file. Thanking You.
[PHP] Execute at a defined time
Hi, I was looking on PHP manual but didn't find anything about it. How can I execute a script all days at the same time? I kno i must have access to the CRON of the system, but don't know what function should I use to make this happen (run the script). Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute at a defined time
Hi, Wednesday, February 5, 2003, 11:49:35 PM, you wrote: MB Hi, MB I was looking on PHP manual but didn't find anything about it. MB How can I execute a script all days at the same time? I kno i must have MB access to the CRON of the system, but don't know what function should I use MB to make this happen (run the script). MB Miguel One simple way is with cron and a web page using lynx like this: 00 00 * * * /usr/bin/lynx -dump http://domain.com/countdown.php 1 /dev/null 2 /dev/null (-dump tells lynx to read the url, dump the page out and exit) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute at a defined time
Hi Miguel, You can use cron to execute the CGI or CLI version of PHP against your PHP script, for example /usr/local/bin/php example.php, simply create a cron entry that will execute at the desired time. If you need information on the crontab format do a man crontab or search google for cron help as there is a lot of information available. Jason On Wed, 2003-02-05 at 06:49, Miguel Brás wrote: Hi, I was looking on PHP manual but didn't find anything about it. How can I execute a script all days at the same time? I kno i must have access to the CRON of the system, but don't know what function should I use to make this happen (run the script). Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute at a defined time
If you have PHP compiled as cgi then you can run something like: php /path/to/my/script.php or if you can request the page via your website with something like: lynx -dump http://your site.com/yourscript.php Also if you want to know how to use cron, try typing man cron in your shell Hope this helps Andrew - Original Message - From: Miguel Brás [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 05, 2003 1:49 PM Subject: [PHP] Execute at a defined time Hi, I was looking on PHP manual but didn't find anything about it. How can I execute a script all days at the same time? I kno i must have access to the CRON of the system, but don't know what function should I use to make this happen (run the script). Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute at a defined time
Thx all for the help Problem solved Miguel Jason Sheets [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi Miguel, You can use cron to execute the CGI or CLI version of PHP against your PHP script, for example /usr/local/bin/php example.php, simply create a cron entry that will execute at the desired time. If you need information on the crontab format do a man crontab or search google for cron help as there is a lot of information available. Jason On Wed, 2003-02-05 at 06:49, Miguel Brás wrote: Hi, I was looking on PHP manual but didn't find anything about it. How can I execute a script all days at the same time? I kno i must have access to the CRON of the system, but don't know what function should I use to make this happen (run the script). Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] execute shell commands
Use sudo (man sudo) Mantas Kriauciunas wrote: Hey! What I want to do is, There is user that logs into the channel. And I need to make script to change his password. How do I execute shell command: passwd ? or what should I do to change that password? Thanks! mNTKz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute shell commands
Hey! What I want to do is, There is user that logs into the channel. And I need to make script to change his password. How do I execute shell command: passwd ? or what should I do to change that password? Thanks! mNTKz
[PHP] Execute a cgi inside of php?
Hello List, Is there a way to execute a cgi inside of php? This is what a customer wants to do: include(!--#exec cgi=../cgi-bin/include/horoscopes.cgi --); but get an error message: Parse error: parse error, unexpected '.' in D:\Inetpub\townforum\wwwroot\orgs\header.php on line 3 The manual says it won't work: http://www.php.net/manual/en/function.include.php Warning Windows versions of PHP prior to PHP 4.3 do not support accessing remote files via this function, even if allow_url_fopen is enabled. The mail archives didn't shed any light on this question. What alternatives might work? Regards, Richard Creech [EMAIL PROTECTED] 250.744.3350 Pacific Time Free and retail php resources for developers http://www.dreamriver.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute a cgi inside of php?
The error you get does not have to do with that note, but rather that code of yours has many other issues such as: a) The syntax is incorrect print a b c d; // bad print a b \ c \ d; // good print a b ' c ' d; // good print 'a b c d'; // good ... http://www.php.net/types.string b) You are attempting to mix SSI into PHP You can't do that, just like how one can't write PERL or ASP code in PHP. Some options: a) Using virtual() virtual(../cgi-bin/include/horoscopes.cgi); b) Go through HTTP $url = 'http://www.example.com/foo/horoscopes.cgi'; echo implode('', file($url)); c) Rewrite horoscopes.cgi as PHP This is the ideal option, consider doing this in the future. That manual note you referred to has to do with code such as (http == remote file): include 'http://www.example.com/foo.php'; Which would include the output of that url into the webpage. This is unrelated and remember that parse errors are always due to syntax problems. Regards, Philip Olson On Wed, 11 Dec 2002, Richard Creech wrote: Hello List, Is there a way to execute a cgi inside of php? This is what a customer wants to do: include(!--#exec cgi=../cgi-bin/include/horoscopes.cgi --); but get an error message: Parse error: parse error, unexpected '.' in D:\Inetpub\townforum\wwwroot\orgs\header.php on line 3 The manual says it won't work: http://www.php.net/manual/en/function.include.php Warning Windows versions of PHP prior to PHP 4.3 do not support accessing remote files via this function, even if allow_url_fopen is enabled. The mail archives didn't shed any light on this question. What alternatives might work? Regards, Richard Creech [EMAIL PROTECTED] 250.744.3350 Pacific Time Free and retail php resources for developers http://www.dreamriver.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php