php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37267 pcntl functions working under mod_php under some distros (FreeBSD/Debian)
Submitted: 2006-05-01 22:13 UTC Modified: 2006-05-02 07:16 UTC
From: php at dogtoe dot com Assigned:
Status: Not a bug Package: PCNTL related
PHP Version: 5.1.2 OS: Linux zeus 2.6.15-gentoo-r1
Private report: No CVE-ID: None
 [2006-05-01 22:13 UTC] php at dogtoe dot com
Description:
------------
I'm hearing contradicting results about pcntl functions working in apache. The manual clearly states they were not meant for webserver environments, but does not say they wont work for webserver environments. It also states that it WILL work for CGI/CLI, but does not say it will NOT work for mod_php (apache module).

I'd like to bring attention to bug #'s 18536 and 32896, where users have said that the pcntl extension is not available. Developers derick and sniper have reported that this is not possible under apache (mod_php) but only in cgi/cli mode.

Well, here's contradicting proof:

TML, an Op in #php on Freenode, has PCNTL working under a debian install, not even self-compiled, as well as other private test-dev machines. Here is phpinfo() from the debian install: http://joeysmith.com/info.php

Additionally, I have confirmed reports of it working under FreeBSD, where the user simply used --enable-pcntl as part of the build command.

I checked with the Gentoo ebuild (package) maintainers and they all claim this is a PHP problem as they are simply passing --enable-pcntl into the build command.

Regardless of any personal bias against using pcntl functions under a webserver, I'd like to know once and foreall if it is possible to somehow enable these functions under mod_php in apache2 because they appear to not even be defined.

Reproduce code:
---------------
$pid = pcntl_fork();

Expected result:
----------------
No errors. 

PCNTL module to show up in phpinfo(). 

No more contradicting results.

Actual result:
--------------
$pid = pcntl_fork();

Returns:

Fatal error: Call to undefined function pcntl_fork() in /var/www/localhost/htdocs/test/index.php on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-01 23:11 UTC] php at dogtoe dot com
Can anyone confirm that the only way to obtain the functions in apache is to generate a shared module for pcntl?
 [2006-05-02 07:16 UTC] mike@php.net
We neither recommend nor support using pcntl with PHP as web server module.
 [2011-08-09 14:45 UTC] martijntje at martijnotto dot nl
This would not be such a big issue, were it not for the fact that PHP does not 
return the correct exit code when using proc_close. The manual clearly indicates 
one should use pcntl_wexitstatus to determine the exit code.

Because of this, it is not possible to get the exit status from a program started 
from apache's mod_php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 07:01:27 2024 UTC