Creating a new php process from within a php script

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Yami King
-


Joined: 08 Sep 2005
Posts: 120

PostPosted: Sun Oct 22, 2006 4:25 pm    Post subject: Creating a new php process from within a php script Reply with quote

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 View user's profile Send private message Send e-mail
abyssisthebest
-


Joined: 30 Jun 2005
Posts: 319
Location: Boston, UK

PostPosted: Sun Oct 22, 2006 7:01 pm    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail MSN Messenger
Yami King
-


Joined: 08 Sep 2005
Posts: 120

PostPosted: Sun Oct 22, 2006 7:07 pm    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Sun Oct 22, 2006 7:21 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Yami King
-


Joined: 08 Sep 2005
Posts: 120

PostPosted: Sun Oct 22, 2006 9:54 pm    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Oct 23, 2006 9:42 am    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail
Yami King
-


Joined: 08 Sep 2005
Posts: 120

PostPosted: Mon Oct 23, 2006 10:41 am    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail
pkSML
-


Joined: 29 May 2006
Posts: 913
Location: Michigan, USA

PostPosted: Mon Oct 23, 2006 10:49 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Yami King
-


Joined: 08 Sep 2005
Posts: 120

PostPosted: Tue Oct 24, 2006 12:08 am    Post subject: Reply with quote

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 View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group