php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71071 Imagick module not loaded with Apache MPM Event
Submitted: 2015-12-09 08:44 UTC Modified: 2015-12-27 04:22 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: antonygraemecox at gmail dot com Assigned: danack (profile)
Status: No Feedback Package: imagick (PECL)
PHP Version: 7.0.0 OS: Centos 7.1.1503
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-12-09 08:44 UTC] antonygraemecox at gmail dot com
Description:
------------
I am unsure whether this is a problem, or appropriate behaviour that either isn't documented, or is and I can't find where.

If you use Apache's mod_mpm_prefork then everything works as expected. If you try to use mod_mpm_event or mod_mpm_worker then Imagick is not loaded as a PHP module when Apache is restarted.

Apache version 2.4.6 using mod_php with version 7.0.0.

Test script:
---------------
With Apache mod_mpm_event or mod_mpm_worker set as the MPM module then simply:

$image = new \Imagick('/path/to/file.jpg');

Will produce an error like: PHP Fatal Error: Uncaught Error: Class 'Imagick' not found in /some/code/location.php


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-09 14:42 UTC] danack@php.net
That exact behaviour would be seen, if Apache/PHP was using a different ini file that did not contain `extension=imagick.so` in it.

Please can you double-check that the ini file being used does attempt to load the module.

There should be an error message somewhere if it is trying but failing; please could you add that error message to your issue.
 [2015-12-10 13:22 UTC] krakjoe@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: danack
 [2015-12-10 13:51 UTC] antonygraemecox at gmail dot com
There don't appear to be any related issues logged to the error_log file. Here are the lines generated when restarting using event.c as the MPM module:

[Thu Dec 10 13:48:09.613067 2015] [mpm_event:notice] [pid 27535:tid 139792752207936] AH00492: caught SIGWINCH, shutting down gracefully
[Thu Dec 10 13:48:10.715556 2015] [suexec:notice] [pid 27693:tid 140191582201920] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Dec 10 13:48:10.728354 2015] [ssl:warn] [pid 27693:tid 140191582201920] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 10 13:48:10.728397 2015] [:notice] [pid 27693:tid 140191582201920] ModSecurity for Apache/2.7.3 (http://www.modsecurity.org/) configured.
[Thu Dec 10 13:48:10.728402 2015] [:notice] [pid 27693:tid 140191582201920] ModSecurity: APR compiled version="1.4.8"; loaded version="1.4.8"
[Thu Dec 10 13:48:10.728405 2015] [:notice] [pid 27693:tid 140191582201920] ModSecurity: PCRE compiled version="8.32 "; loaded version="8.32 2012-11-30"
[Thu Dec 10 13:48:10.728408 2015] [:notice] [pid 27693:tid 140191582201920] ModSecurity: LUA compiled version="Lua 5.1"
[Thu Dec 10 13:48:10.728410 2015] [:notice] [pid 27693:tid 140191582201920] ModSecurity: LIBXML compiled version="2.9.1"
[Thu Dec 10 13:48:10.782987 2015] [auth_digest:notice] [pid 27693:tid 140191582201920] AH01757: generating secret for digest authentication ...
[Thu Dec 10 13:48:10.783539 2015] [lbmethod_heartbeat:notice] [pid 27693:tid 140191582201920] AH02282: No slotmem from mod_heartmonitor
[Thu Dec 10 13:48:10.796385 2015] [ssl:warn] [pid 27693:tid 140191582201920] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 10 13:48:10.828598 2015] [mpm_event:notice] [pid 27693:tid 140191582201920] AH00489: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips PHP/7.0.0 configured -- resuming normal operations
[Thu Dec 10 13:48:10.828626 2015] [core:notice] [pid 27693:tid 140191582201920] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
 [2015-12-10 13:53 UTC] antonygraemecox at gmail dot com
In comparison, here are the entries when restarted with prefork MPM:

[Thu Dec 10 13:52:03.308508 2015] [mpm_event:notice] [pid 27693:tid 140191582201920] AH00492: caught SIGWINCH, shutting down gracefully
[Thu Dec 10 13:52:04.404931 2015] [suexec:notice] [pid 27801] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Dec 10 13:52:04.417783 2015] [ssl:warn] [pid 27801] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 10 13:52:04.429056 2015] [:notice] [pid 27801] ModSecurity for Apache/2.7.3 (http://www.modsecurity.org/) configured.
[Thu Dec 10 13:52:04.429075 2015] [:notice] [pid 27801] ModSecurity: APR compiled version="1.4.8"; loaded version="1.4.8"
[Thu Dec 10 13:52:04.429078 2015] [:notice] [pid 27801] ModSecurity: PCRE compiled version="8.32 "; loaded version="8.32 2012-11-30"
[Thu Dec 10 13:52:04.429082 2015] [:notice] [pid 27801] ModSecurity: LUA compiled version="Lua 5.1"
[Thu Dec 10 13:52:04.429083 2015] [:notice] [pid 27801] ModSecurity: LIBXML compiled version="2.9.1"
[Thu Dec 10 13:52:04.472227 2015] [auth_digest:notice] [pid 27801] AH01757: generating secret for digest authentication ...
[Thu Dec 10 13:52:04.472766 2015] [lbmethod_heartbeat:notice] [pid 27801] AH02282: No slotmem from mod_heartmonitor
[Thu Dec 10 13:52:04.485546 2015] [ssl:warn] [pid 27801] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 10 13:52:04.532885 2015] [mpm_prefork:notice] [pid 27801] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips configured -- resuming normal operations
[Thu Dec 10 13:52:04.532904 2015] [core:notice] [pid 27801] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
 [2015-12-10 15:08 UTC] danack@php.net
As I said before:
"That exact behaviour would be seen, if Apache/PHP was using a different ini file that did not contain `extension=imagick.so` in it. Please can you double-check that the ini file being used does attempt to load the module."

Please can you check the ini file being used. One way of doing this is to do phpinfo() in a page served by the server, and look the line:

    Loaded Configuration File	/etc/php.ini

And check that your server is attempting to load Imagick.
 [2015-12-14 10:37 UTC] antonygraemecox at gmail dot com
-Status: Feedback +Status: Assigned
 [2015-12-14 10:37 UTC] antonygraemecox at gmail dot com
Hi

I can confirm that the directory of additional ini files to be parsed is changed when you switch to the event.c MPM so the ini file containing the extension=imagick.so declaration wasn't being included. Also, a different module directory is used for this MPM. However, if I do include that ini file in this location, and copy the imagick.so to the new php-zts directory then it does still fail to load imagick but with an error in the logs. That error is:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php-zts/modules/imagick.so' - /usr/lib64/php-zts/modules/imagick.so: undefined symbol: core_globals in Unknown on line 0
 [2015-12-14 16:29 UTC] danack@php.net
-Status: Assigned +Status: Feedback
 [2015-12-14 16:29 UTC] danack@php.net
"and copy the imagick.so to the new php-zts directory then it does still fail to load imagick but with an error in the logs."

This doesn't work.

You can't just copy library files around and expects stuff to magically work.

When Imagick is compiled, the code that is generated is different based on whether it's being compiled against the thread safe version of PHP, or whether it's being compiled against the version that isn't thread safe.

You need to install an appropriately compiled version for the worker type you want to use.
 [2015-12-27 04:22 UTC] pecl-dev 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.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 30 21:01:23 2021 UTC