Jump to content


Photo

Call to undefined function: pcntl_fork()


  • Please log in to reply
5 replies to this topic

#1 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 29 August 2006 - 01:00 AM

I think that I am most likely missing something in the php.ini. When I try a simple forking script I get the following error.  Call to undefined function: pcntl_fork()

here is the forking script
<?php
$pid = pcntl_fork();
if ($pid == -1) {
    die("The fork did not work");
}elseif ($pid) {
    echo "This is the parent and the pid is <b>$pid</b><br />";
}else{
    echo "This is the child and the pid is <b>$pid</b>";
}
?>

I am testing this on a windows platform with php 5.0.2

Any suggestions would be great.

Thanks,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#2 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 29 August 2006 - 01:09 AM

Installation

Process Control support in PHP is not enabled by default. You have to compile the CGI or CLI version of PHP with --enable-pcntl configuration option when compiling PHP to enable Process Control support.

    Note: Currently, this module will not function on non-Unix platforms (Windows).

http://www.php.net/m...n/ref.pcntl.php

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 29 August 2006 - 01:13 AM

lol.. I guess I should read the manual fully. Thanks.

Well I have a problem then. I am attempting to fork a socket script and I have no idea how. I looked at the phpfreaks forking tutorial and realized that it is not realy forking tutorial but rather a tutorial for back dooring a process.

Any suggestions?

Thanks again,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#4 Yesideez

Yesideez
  • Members
  • PipPipPip
  • Advanced Member
  • 2,334 posts
  • LocationDevon, UK

Posted 29 August 2006 - 07:38 AM

Erm...
<?php
if ($all_that_can_be_learnt == $is_learnt) {
    $life = "Boring";
}
?>
Bad grammar! :D
Not a pro just an enthusiast :)

if (empty($coffee)) {$coffee=new coffee();}

Please surround any code using the CODE tags - I rarely look at anything without them

#5 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 29 August 2006 - 11:56 AM

Why do you need to fork, out of curiosity? There is practically no need to fork for any web application scenario.

#6 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 29 August 2006 - 12:14 PM

@Jenk
I have written a socket server that realy bogs the server. 

@Yessideez
I guess that I will stop asking questions here. Every time I do I am met with sarcasm.

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users