php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69814 Enabling php_curl, php_mysqli, and php_openssl causes php-cgi to crash
Submitted: 2015-06-12 13:56 UTC Modified: 2015-06-14 17:17 UTC
From: theodorejb at outlook dot com Assigned: ab (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 5.5+ OS: Windows Server 2012 R2
Private report: No CVE-ID: None
 [2015-06-12 13:56 UTC] theodorejb at outlook dot com
Description:
------------
I'm using the VC14 x86 Non Thread Safe version.

Starting from the default php.ini development file, I uncommented the following lines:

extension_dir = "ext"
extension=php_curl.dll
extension=php_mysqli.dll
extension=php_openssl.dll

After doing this, running php-cgi.exe -b 127.0.0.1:9000 results in a "CGI / FastCGI has stopped working" crash almost every time.

Strangely, the crash isn't 100% consistent. In a couple cases, it didn't crash when running the command, but did as soon as I passed a request to the server via nginx. On one occasion, it didn't crash and I was able to pass requests to it, but when my code attempted to access mysqli, I got the following error:

<b>Fatal error</b>:  Uncaught EngineException: Class 'mysqli' not found in C:\Users\Theodore\Documents\Code\myFile.php:20


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-12 18:57 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2015-06-12 18:57 UTC] ab@php.net
Thank you for the report. As far as I could debug yet, this issue is present in at least 5.6 as well. Were it possible you to check the 5.5 branch as well?

Thanks.
 [2015-06-12 19:05 UTC] ab@php.net
Ups, i wanted to write - 5.5 and 5.6 as well.

Thanks.
 [2015-06-12 19:33 UTC] theodorejb at outlook dot com
I also tested PHP 5.5.26 and PHP 5.6.10 with identical changes to the php.ini config, but I haven't been able to reproduce it on those versions. The issue appears to be PHP 7 specific.
 [2015-06-12 20:01 UTC] ab@php.net
-Status: Feedback +Status: Verified
 [2015-06-12 20:01 UTC] ab@php.net
Thanks for checking ... in my case it was 5.6.9-Win32-VC11-x64 which crashes the same way. Strangely a debug build doesn't crash ... I'm debugging it further, but I already confirm the issue. It were just essential to ensure it is (or is not) 7.0 specific. 

Thanks.
 [2015-06-13 06:27 UTC] kalle@php.net
-PHP Version: 7.0.0alpha1 +PHP Version: 5.5+
 [2015-06-13 16:45 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6084844fb5b93d3712d5b1376ed99bfa6c51b637
Log: Fix bug #69814 Enabling php_curl, php_mysqli, and php_openssl causes php-cgi to crash
 [2015-06-13 16:45 UTC] ab@php.net
-Status: Verified +Status: Closed
 [2015-06-13 16:55 UTC] ab@php.net
-Status: Closed +Status: Feedback -Assigned To: +Assigned To: ab
 [2015-06-13 16:55 UTC] ab@php.net
@theodorejb, please check whether this build fixes the issue for you http://windows.php.net/downloads/snaps/ostc/69814/

Thanks.
 [2015-06-13 17:19 UTC] theodorejb at outlook dot com
-Status: Feedback +Status: Assigned
 [2015-06-13 17:19 UTC] theodorejb at outlook dot com
The test build is still crashing for me, unless I disable one of the aforementioned extensions.
 [2015-06-13 17:39 UTC] ab@php.net
-Status: Assigned +Status: Feedback
 [2015-06-13 17:39 UTC] ab@php.net
Thanks for the quick check. Please post your nginx config and if possible a php repro snippet.

Cheers.
 [2015-06-13 17:40 UTC] ab@php.net
Ah, and if you can get a backtrace, or even a dump, please post as well.

Thanks.
 [2015-06-13 19:50 UTC] theodorejb at outlook dot com
I don't think the issue is related to my nginx config. php_cgi is crashing immediately when I try to run it, even if nginx isn't started.

Here's a thread dump I was able to grab:

Thread report
Entry point   php_cgi!mainCRTStartup 
Create time   2015-06-13 14:33:03 
Time spent in user mode   0 Days 00:00:00.000 
Time spent in kernel mode   0 Days 00:00:00.015 

Function                                                                                                Source
php7ts!zend_startup_module_ex+6 [c:\php-sdk\phpmaster\vc14\x64\php-src\zend\zend_api.c @ 1818]          c:\php-sdk\phpmaster\vc14\x64\php-src\zend\zend_api.c @ 1818
php7ts!zend_hash_apply+86 [c:\php-sdk\phpmaster\vc14\x64\php-src\zend\zend_hash.c @ 1434 + 6]           c:\php-sdk\phpmaster\vc14\x64\php-src\zend\zend_hash.c @ 1434 + 6
php7ts!zend_startup_modules+30 [c:\php-sdk\phpmaster\vc14\x64\php-src\zend\zend_api.c @ 1987]           c:\php-sdk\phpmaster\vc14\x64\php-src\zend\zend_api.c @ 1987
php7ts!php_module_startup+a4b [c:\php-sdk\phpmaster\vc14\x64\php-src\main\main.c @ 2201]                c:\php-sdk\phpmaster\vc14\x64\php-src\main\main.c @ 2201
php_cgi!php_cgi_startup+17 [c:\php-sdk\phpmaster\vc14\x64\php-src\sapi\cgi\cgi_main.c @ 915 + 13]       c:\php-sdk\phpmaster\vc14\x64\php-src\sapi\cgi\cgi_main.c @ 915 + 13
php_cgi!main+5ed [c:\php-sdk\phpmaster\vc14\x64\php-src\sapi\cgi\cgi_main.c @ 1894 + d]                 c:\php-sdk\phpmaster\vc14\x64\php-src\sapi\cgi\cgi_main.c @ 1894 + d
php_cgi!__scrt_common_main_seh+124 [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 264 + 22]  f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl @ 264 + 22
kernel32!BaseThreadInitThunk+22
ntdll!RtlUserThreadStart+34
 [2015-06-13 20:10 UTC] ab@php.net
Yeah, by further investigation it seems so. See bug #69820. Strangely here I had completely another crash when using a screwed up nginx config, and that's what i've fixed ... That's why i said it's in 5.6, and it is, it was fixed by the patch i've pushed, will have to backport it. But now there's a clear issue with module loading.

Thanks for the dump.
 [2015-06-14 10:39 UTC] ab@php.net
@theodorejb please recheck the snapshot http://windows.php.net/downloads/snaps/ostc/69814/ again. Made a new build. This issue is most likely related to bug #69823.

Thanks.
 [2015-06-14 16:39 UTC] theodorejb at outlook dot com
The new build works for me without crashing.
Thank you so much for quickly getting this fixed!
 [2015-06-14 17:17 UTC] ab@php.net
-Status: Feedback +Status: Closed
 [2015-06-14 17:17 UTC] ab@php.net
Thanks for testing the 7.0.0alpha1!

Btw with the php-cgi bug - it's indeed not reproducable with 5.6.10, but 5.6.9. Seems that something didn't make it through into 7.0. But that's another story now.

Cheers.
 [2015-06-23 18:04 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6084844fb5b93d3712d5b1376ed99bfa6c51b637
Log: Fix bug #69814 Enabling php_curl, php_mysqli, and php_openssl causes php-cgi to crash
 [2016-07-20 11:38 UTC] davey@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6084844fb5b93d3712d5b1376ed99bfa6c51b637
Log: Fix bug #69814 Enabling php_curl, php_mysqli, and php_openssl causes php-cgi to crash
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 23 18:01:23 2021 UTC