Asheeown
-
Posts
471 -
Joined
-
Last visited
Posts posted by Asheeown
-
-
The period indicates continuation in the string, no?
-
$IP = $_SERVER['REMOTE_ADDR']; echo("Hello user your IP is: $IP");
-
Okay I'll leave it with another question.
If in the same script as executing the background script did I run a tasklist command that pulled an entire list of processes could I pull the PID from there?
Meaning that once the script has executed the list command will run and php will grab the absolute last process called "php.exe" and get it's PID since processes are listed in order of executed on tasklist.
Would this work or if someone executed at the same time as someone else could the PIDs get mixed up? Please someone answer this question since it's based on pure logic and doesn't have anything to do with Windows or Linux OS. Thank you.
-
Bump, probably last time I'm going to because it just seems hopeless at this point
-
Bump
-
I'm looking to kill the process that's all. When the user hasn't updated his status, meaning refreshing the page, a cron job will run through for inactive users up to 10 minutes and kill inactive user processes.
-
4 days...bump
-
Sorry it took so long but no it didn't work, it printed
on the screen and the process still runs in the background. If I print the command it returns a 0, probably 0 or 1 for telling php if it's waiting for execution to finish.com Object -
Bump for 2 days gone by
-
Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup `ProcessId': Unknown name. ' in C:\xampp\htdocs\EGM\test.php:12 Stack trace: #0 C:\xampp\htdocs\EGM\test.php(12): unknown() #1 {main} thrown in C:\xampp\htdocs\EGM\test.php on line 12
$dir = "C:/xampp/php"; $php_path = "C:/xampp/php/php.exe"; $file = "myscript.php"; $cmd_options = "-t " . time(); $wscript = new COM('WScript.Shell'); $Command = $wscript->Run("$php_path $dir/$file", 0, false); $PID = $wscript->ProcessId; echo $PID;
Everything works fine until I add the $PID = $wscript->ProcessId; in.
-
Okay, guess I'll bump it again even though it seems worthless
-
Sure your php.ini file is setup correctly?
-
I use:
<?php session_start(); unset($_SESSION); ?>
quick and easy
-
Basically, I want to access one of the properties of the COM Object.
Now, com_get would work fantastic, however it has been discontinued ever since php5, this is the note that comes along with the manual for COM_GET
Note: This function does not exist in PHP 5; instead, you should use the regular and more natural OO syntax to access properties or call methods.
If anyone could point me in the direction of how to write an OO syntax for this situation it would be the most amazing thing ever.
-
Wouldn't work anyway, I need the specific PID that was started on that page.
-
I need to get the process ID of a background process I'm executing and I can't seem to get it.
OS: Windows
$dir = "C:/xampp/php"; $php_path = "C:/xampp/php/php.exe"; $file = "myscript.php"; $cmd_options = "-t " . time(); $wscript = new COM('WScript.Shell'); $Command = $wscript->Run("$php_path $dir/$file", 0, false);
Any ideas?
-
Success! I got it working, OK one more question, the com_get to pull a property from a COM object has been deprecated in PHP5. I need to pull the process ID from the execution I am running.
$dir = "C:/xampp/php"; $php_path = "C:/xampp/php/php.exe"; $file = "myscript.php"; $cmd_options = "-t " . time(); $wscript = new COM('WScript.Shell'); $Command = $wscript->Run("$php_path $dir/$file", 0, false);
-
Well before I sign off tonight I figure I should post my new code, this code is working, but isn't working lol.
<?php $dir = "C:/xampp/php"; $php_path = "C:/xampp/php/php.exe"; $file = "myscript.php"; $cmd_options = "-t " . time(); $wscript = new COM('WScript.Shell'); echo $wscript->Run("cmd /K CD $php_path $dir/$file > output.txt & ", 0, false); ?>
Replicated it completely in Windows and I get an Access is Denied read out. Vista kills me but Windows Server 2008 does the same access bull**** so does anyone know how to setup permissions so that it won't require admin access? Or any other hints perhaps?
-
Well if anyone could point me in the direction of a COM tutorial I have seen that they can execute processes but have yet to see an example or even an explanation for that matter.
-
Yes
It works for command prompt using the EXACT same execution as I use in the PHP. Php has to have a way to not want any output or maybe an alternative way would do? This is a user triggered script so when a user browses to this page it's going to start, I can't have it hung up in the background.
-
The process works fine in CMD. It executes directly into output.txt and the important thing it does not hang on the process it automatically returns to a new line but the process is still running in the background.
-
Okay been a few days so I guess I'll bump it.
The problem I am having is the page that is loading the background process is hanging at loading, it's trying to incorporate the background process in the page which I don't want to happen.
-
Okay figured out why it's not starting, needed forward instead of backslashes. However it sits at loading on the page, I need it to be completely in the background so that the web page is completely unaffected by the execution.
-
Okay, primary goal here is this:
User views a page that executes a background php script that continuously pulls data from a certain source and loads it into the database.
Two things I am having problems with
1. The script won't execute I am doing a simple script output to a text file and it doesn't show but works in command prompt
2. I cannot seem to figure out how to get the PID of the php process running.
Installation structure is xampp full installation so phhp is under the xampp folder, this is not the structure for my real server, is is a server 2008 server with fastcgi php installed.
Here is the code I am using to execute the file
<?php $Command = exec("C:\xampp\php\php.exe C:\xampp\php\myscript.php > output.txt"); echo $Command; ?>
many webpages in one php file
in PHP Coding Help
Posted
You can do this:
index.php?Page=Links
index.php:
If you do multiple pages do NOT do
That leads to all types of injection and you don't want any part of that, if you get to use many more pages just use a switch statement and put all your possibilities in there.