Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Parallel Processing in PHP
Closed Thread
Old 09-08-2005, 07:36 PM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2005

Posts: 1

alirizwan

Default Parallel Processing in PHP

Hi,

I want to perform Parallel Processing in PHP. Let me try to explain my problem.
I want to open 2 files with fopen at the same time.

For Example first file takes 30 seconds and 30 seconds seond file to read in web.
and total time will be 60 seconds.
Can i read both files in 30 seconds with parallel execuation?

<?php

$handle_1 = fopen("www.domain.com/index.php", "r");
$text_1 = fread($handle_1,filesize("$handle_1"));
fclose($handle_1);

$handle_2 = fopen("www.domain.com/index.php", "r");
$text_2 = fread($handle_2,filesize("$handle_2"));
fclose($handle_2);

$text = $text_1 . $text_2;

print $text;

?>

As above code run line by line and takes much time. Is there any way that i can open both or more files Simultaneous ?
How can i execute some my code in parallel processing?


Regards,

Ali Rizwan (Web Developer)
Aztek Computers
http://www.aztekcomputers.com
alirizwan is offline  
Old 09-10-2005, 10:51 PM   #2 (permalink)
 
Super Techie

Join Date: May 2005

Posts: 479

furtivefelon

Default

there is no possible way that your computer can parallel process unless if you have two or more processors..
__________________
lisp hacker
running: FreeBSD 5.4 - still learning
develop with: SBCL + emacs for lisp, Anjuta IDE +gcc for c, SPE for python..
browse with: opera
furtivefelon is offline  
Old 09-11-2005, 12:39 AM   #3 (permalink)
 
Monster Techie

Join Date: Jul 2003

Posts: 1,179

Emily is on a distinguished road

Send a message via AIM to Emily
Default

You can't parallel process without multiple processors, but you can multithread. Then again, I'm pretty sure you can't multithread in PHP. (I could very easily be wrong though.) If this is for a full web application (not just like opening a file and printing its contents), maybe Java would work.
__________________
<a href=\"http://www.upstark.com\">www.upstark.com</a>
Emily is offline  
Old 09-12-2005, 09:18 PM   #4 (permalink)
 
Super Techie

Join Date: Apr 2004

Posts: 316

BlazingWolf

Default

Theres no multithreading in PHP. If it really takes that long theres probably a better way to do. :/ PHP really just can't handle lots of working with files.
__________________
BlazingWolf
<font color=\'red\'>
<b>
<a href=\'http://www.gaming-forums.org\'>
Gaming-Forums.org
<a/>
</b>
</font>
BlazingWolf is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On