php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65277 PHP-5.4.x and PHP-5.5.x extensions single-shot when loaded per-pool
Submitted: 2013-07-17 07:37 UTC Modified: 2021-09-02 11:43 UTC
From: bruno dot premont at restena dot lu Assigned: cmb (profile)
Status: Closed Package: FPM related
PHP Version: 5.4.17 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bruno dot premont at restena dot lu
New email:
PHP Version: OS:

 

 [2013-07-17 07:37 UTC] bruno dot premont at restena dot lu
Description:
------------
Loading extensions on a per-pool basis make the extension usable only a single time per worker process.
Loading the extension globally for PHP via php.ini works fine.

Working setup:
php.ini:
  extension=radius.so

Failing setup:
php-fpm.conf
  [pool]
  php_admin_value[extension] = radius.so


On failing setup following test-script fails with radius_auth_open: undefined function for second request. Easiest testing is pm=ondemand, long enough pm.process_idle_timeout and two subsequent requests. First request works, second one fails. The module is still reported as loaded and its functions are still returned by get_extension_funcs() even though they are undefined.

Test script:
---------------
<?php
date_default_timezone_set('Europe/Luxembourg');
header('Content-Type: text/plain; charset=UTF-8');

printf("Checking for 'radius' extension: %s\n", extension_loaded('radius') ? 'loaded' : 'missing');

$fa = get_extension_funcs('radius');
printf("Checking for 'radius' extension functions:%d\n", $fa === false ? -1 : count($fa));
if ($fa !== false)
        foreach ($fa as $faf)
                printf("\t%s(): %s\n", $faf, function_exists($faf) ? 'exists' : 'missing');

flush();

printf("Calling radius_auth_open():\n");flush();
$rh = function_exists('radius_auth_open') ? radius_auth_open() : false;
printf("\t%s\n", $rh === false ? 'false' : 'resource');

if ($rh) {
        // use $rh
        ...
        printf("Calling radius_close()\n");flush();
        $r = radius_close($rh);
        printf("\t%s\n", $r === true ? 'success' : 'failed');
}
?>

Expected result:
----------------
The radius functions should be usable for each request and not only the ones that happens to be the first request processed by the respective worker.

Actual result:
--------------
First request works, second and subsequent requests to same worker process fail with undefined function on any call to extension functions.

extension_loaded() and get_extension_funcs() still return same information for subsequent requests as they do for the first request.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-11 12:45 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-11 12:45 UTC] cmb@php.net
Is this is still an issue with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-08-22 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2021-09-02 11:43 UTC] bruno dot premont at restena dot lu
-Status: No Feedback +Status: Closed
 [2021-09-02 11:43 UTC] bruno dot premont at restena dot lu
Sorry for delayed response.

At first glance, works as expected with PHP-7.3, PHP-7.4 and PHP-8.0.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Aug 19 23:05:44 2022 UTC