View previous topic :: View next topic |
Author |
Message |
Yami King -
Joined: 08 Sep 2005 Posts: 120
|
Posted: Sun Oct 22, 2006 4:25 pm Post subject: Creating a new php process from within a php script |
|
|
Hi,
I wanted to know how I could create a new php process, within a php script.
Should work like this:
php.exe (1)
newproc.php -> create php process
php.exe (2)
// want to allow scripts to run in this one (2), and the previous one (1) at the same time
Is this possible, without too much loading time and computer crashes :P? |
|
Back to top |
|
|
abyssisthebest -
Joined: 30 Jun 2005 Posts: 319 Location: Boston, UK
|
Posted: Sun Oct 22, 2006 7:01 pm Post subject: |
|
|
why would you want to do this?
Abyss automatically opens a php.exe when a php script is called (If you have set it up right) _________________ My online Portfolio |
|
Back to top |
|
|
Yami King -
Joined: 08 Sep 2005 Posts: 120
|
Posted: Sun Oct 22, 2006 7:07 pm Post subject: |
|
|
I was just wondering, could be nice to do this so.
BTW: Don't say Runkit does the job, because I want something that's crossplatform (as far as possible) and don't want to use any (or atleast as few as possible) extensions that are not available by standard. |
|
Back to top |
|
|
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Sun Oct 22, 2006 7:21 pm Post subject: |
|
|
Abyss automatically does what you have asked to do. If two scripts need to run at once then two php.exe processes are opened. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
|
Yami King -
Joined: 08 Sep 2005 Posts: 120
|
Posted: Sun Oct 22, 2006 9:54 pm Post subject: |
|
|
But how can I request to run another script from the requested page in another process.
Like:
The visitor requests `test.php`.
The php interpreter sees that `test.php` calls another php process to run `test2.php`
The server sends the processed `test.php` and `test2.php` to the visitor
(test.php and test2.php need to be returned as 1 single file but need to be processed separatly so both pages use a single php.exe process)
Quite hard to explain, but the basic idea I want is some kind of dualcore processing for php. |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Oct 23, 2006 9:42 am Post subject: |
|
|
Yami King,
PHP has no standard way to do that.
If you are on Windows, you can call the Win32 API to create a new process and to later get its output (but that's not easy to do especially with PHP). On other operating systems, you'll have to do something similar (calling the OS primitives that are responsible of creating new processes). But that's not recommended and it won't probably help the speed of your processing (even if you have a dual core) since you have no guarantee that each PHP process will be executed on a different CPU core (there are other processes running so your OS can decide that the CPU allocation is better if the second CPU is used by Abyss or other applications while PHP is running). _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
Yami King -
Joined: 08 Sep 2005 Posts: 120
|
Posted: Mon Oct 23, 2006 10:41 am Post subject: |
|
|
Too bad this can't be done. Did look at some primitive ways like the W32 API but that's not a great solution indeed. |
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 952 Location: Michigan, USA
|
Posted: Mon Oct 23, 2006 10:49 pm Post subject: |
|
|
YamiKing, are you trying to just get a PHP script to execute another PHP script? It won't give you any speed improvement (actually, PHP's initialization will take time).
Anyways, I use Code: | system("c:\php\php.exe d:\my_php_script.php"); |
I guess the benefit to this is being able to run scripts outside of your web directories. _________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
|
Yami King -
Joined: 08 Sep 2005 Posts: 120
|
Posted: Tue Oct 24, 2006 12:08 am Post subject: |
|
|
My goal is to retrieve a better performance, using multi-tasking between php processes.
This can be compared as dual core (in the most simplest idea). |
|
Back to top |
|
|
|