php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51307 php.exe error on command line
Submitted: 2010-03-16 14:32 UTC Modified: 2012-04-26 09:02 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: joerg dot klein at ifsam dot lu Assigned: pajoye (profile)
Status: Not a bug Package: Reproducible crash
PHP Version: 5.3.10 OS: win32 only-Windows Server 2003/8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: joerg dot klein at ifsam dot lu
New email:
PHP Version: OS:

 

 [2010-03-16 14:32 UTC] joerg dot klein at ifsam dot lu
Description:
------------
I have several scripts that runs from the command line. Some of them causes an error in the Event Viewer since 5.3.2:
Application Failure  php.exe 5.3.2.0 in php5ts.dll 5.3.2.0 at offset 0000c4d6

With 5.3.1 the scripts runs without any error.

I tried to track down the error on one example, but I can't tell you where exact the error occurs. Renaming the files/directories or just removing a line of code and the error is gone. It's strange.

mysql and gd2 extension was loaded in php.ini

Test script:
---------------
Run the upload_pending.php from the archive within the given directory.
Ignore the runtime errors, I have reduced the code as much as possible.

http://ifsam.net/test.php

Expected result:
----------------
no error ;)


Patches

php-m (last revision 2010-03-16 14:08 UTC by joerg dot klein at ifsam dot lu)
php-n-m (last revision 2010-03-16 14:07 UTC by joerg dot klein at ifsam dot lu)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-16 14:34 UTC] joerg dot klein at ifsam dot lu
sorry the link to the test files is
http://ifsam.net/test.zip
 [2010-03-16 14:42 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-16 14:42 UTC] pajoye@php.net
pls run in the console:

php.exe -n -m

then
php.exe -m

and finally php -i

paste the output of each in separate text files and attacht them to this report.
 [2010-03-16 14:59 UTC] joerg dot klein at ifsam dot lu
can I attach them as patch?
 [2010-03-16 15:04 UTC] pajoye@php.net
yes
 [2010-03-16 15:19 UTC] joerg dot klein at ifsam dot lu
you can find the php -i output here:
http://ifsam.net/php_i.txt

your parser detects it as "text/x-pascal" ;)
 [2010-03-16 15:21 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-16 15:21 UTC] pajoye@php.net
Still need the other two outputs :)
 [2010-03-16 15:24 UTC] joerg dot klein at ifsam dot lu
they were attached as patch already
 [2010-03-16 15:33 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-16 15:33 UTC] pajoye@php.net
Not sure what's wrong.

Which line are you referering to in your initial comment?

Please try to create a one file script to reproduce the error.
 [2010-03-16 15:39 UTC] pajoye@php.net
btw, try to fix your code while being at it:

Warning: in_array() expects parameter 2 to be array, null given in C:\test\51307\error_handler.php on line 31

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in C:\test\51307\error_handler.php on line 39

Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in C:\test\51307\error_handler.php on line 55

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\test\51307\error_handler.php on line 116

Warning: in_array() expects parameter 2 to be array, null given in C:\test\51307\error_handler.php on line 119
<font color="red"><b>Error</b>: Use of undefined constant require_path - assumed 'require_path' in <b>C:\test\51307\conf.php</b> on line <b>2</b><br></font><br>
 [2010-03-16 15:43 UTC] joerg dot klein at ifsam dot lu
I wasn't referering to a specific line. I removed step-by-step all lines which produces no error.

I tried to reproduce a one file script without success.
I think the error depends on including files and the length of the filenames/Directories. When I shorten the dir- or the filename, the error is gone.
 [2010-03-16 15:46 UTC] joerg dot klein at ifsam dot lu
as I stated above: Ignore the runtime errors, I have reduced the code as much as possible to track down the problem.

With the correct and complete source code, the same error occurs.
 [2010-03-16 15:48 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-16 15:48 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

I can't reproduce any crash with the code you have provided. Please provide a backtrace if you can, that should be a start.
 [2010-03-16 15:49 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2010-03-16 16:15 UTC] joerg dot klein at ifsam dot lu
Backtrace:

Thread 0 - System ID 1180
Entry point   php!mainCRTStartup 
Create time   16.03.2010 16:09:36 
Time spent in user mode   0 Days 0:0:0.15 
Time spent in kernel mode   0 Days 0:0:0.93 

Function     Arg 1     Arg 2     Arg 3   Source 
php5ts!_zend_mm_free_int+66     002250f8     5c6e6574     100d2214    
php5ts!_efree+36     01ad44b0     00223ba8     101f2e05    
php5ts!closelog+54     101ae8b7     00000001     00000013    
php5ts!zm_deactivate_syslog+5     00000001     00000013     00223ba8    
php5ts!zm_deactivate_basic+e7     00000001     00000013     00223ba8    
php5ts!module_registry_cleanup+1c     01bfcca8     00223ba8     00c0fb24    
php5ts!zend_hash_reverse_apply+42     1054d280     10008400     00223ba8    
php5ts!zend_deactivate_modules+62     00c0ffb0     00000000     56433230    
php5ts!zend_deactivate_modules+48     00229adc     00223ba8     100bbbdb    
php5ts!zend_llist_clean+b     00229adc     00000000     00c0fdf0    
php5ts!php_deactivate_ticks+1b     00c0fc0c     00223ba8     00c0fea8    
php5ts!execute+2fe     01b00128     00223b00     00000000    
php5ts!zend_execute_scripts+f6     00c0ffb0     00000000     56433230    
php5ts!php_request_shutdown+13d     00000002     00220178     01ace4c8    
msvcrt!_lseek+aa     00c0ffb0     00000000     56433230    
php5ts!php_request_shutdown+206     77bbd08c     00220000     00000000    
ntdll!RtlAllocateHeap+ee7     00000000     00000000     7ffda000    
kernel32!BaseProcessStart+23     00402d78     00000000     00000000    

PHP5TS!_ZEND_MM_FREE_INT+66In php__PID__1284__Date__03_16_2010__Time_04_09_56PM__366__Second_Chance_Exception_C0000005.dmp the assembly instruction at php5ts!_zend_mm_free_int+66 in C:\Program Files\Apache Group\Apache\php-bin\php5ts.dll from The PHP Group has caused an access violation exception (0xC0000005) when trying to read from memory location 0x5e1baa1c on thread 0

Module Information 
Image Name: C:\Program Files\Apache Group\Apache\php-bin\php5ts.dll   Symbol Type:  PDB 
Base address: 0x10000000   Time Stamp:  Wed Mar 03 20:38:42 2010  
Checksum: 0x00000000   Comments:   
COM DLL: False   Company Name:  The PHP Group 
ISAPIExtension: False   File Description:  PHP Script Interpreter 
ISAPIFilter: False   File Version:  5.3.2 
Managed DLL: False   Internal Name:  PHP Script Interpreter 
VB DLL: False   Legal Copyright:  Copyright © 1997-2009 The PHP Group 
Loaded Image Name:  php5ts.dll   Legal Trademarks:  PHP 
Mapped Image Name:  C:\Program Files\Apache Software Foundation\Apache2.2\php-bin\php5ts.dll   Original filename:  php5ts.dll 
Module name:  php5ts   Private Build:   
Single Threaded:  False   Product Name:  PHP 
Module Size:  5,50 MBytes   Product Version:  5.3.2 
Symbol File Name:  C:\Program Files\Apache Software Foundation\Apache2.2\php-bin\php5ts.pdb   Special Build:  &
 [2010-03-16 16:54 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-16 16:54 UTC] pajoye@php.net
Please disable all extensions and enable them again one by one to figure out which one.
 [2010-03-17 09:11 UTC] joerg dot klein at ifsam dot lu
By disabling gd2 or mysql or both, the error is gone.
I only have these to extensions enabled.
 [2010-03-17 10:37 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-03-17 10:37 UTC] pajoye@php.net
I see only one cause, some old version of these extensions are being loaded. Or extensions not from the same PHP releases (VC6 instead of VC9 for example, for php 5.3).

But there are no problem in 5.3.2's gd or mysql extensions. They work just fine (cli as you see yourself), apache, etc.). I would double check that apache is actually using the same configuration than CLI (via a simple phpinfo), and compare the paths (extension_dir, loaded php.ini).
 [2010-03-17 11:47 UTC] joerg dot klein at ifsam dot lu
I double checked both configurations and both apache and cli are using the same php.ini and also the same settings.
Nothing was changed since the previous working php versions. The only change to the system was replacing the php directory. Since 5.3 I use always the VC6 TS versions. 
I also have redownloaded and installed the 5.3.2 VC6 TS win32 binaries without success.

Something has to be changed from 5.3.1 to 5.3.2.
 [2010-03-17 20:39 UTC] jani@php.net
-Package: Unknown/Other Function +Package: Reproducible crash -Operating System: Windows Server 2003 +Operating System: win32 only - Windows Server 2003
 [2010-06-08 14:45 UTC] tony2001@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: pajoye
 [2010-06-20 17:05 UTC] pajoye@php.net
-Status: Assigned +Status: Feedback
 [2010-06-20 17:05 UTC] pajoye@php.net
Did you install mysql too on this machine?
 [2010-06-21 07:34 UTC] joerg dot klein at ifsam dot lu
-Status: Feedback +Status: Open
 [2010-06-21 07:34 UTC] joerg dot klein at ifsam dot lu
yes
 [2010-06-21 09:41 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-06-21 09:41 UTC] pajoye@php.net
Be sure that the PHP directory is first in your PATH, not MySql.
 [2010-06-21 10:08 UTC] joerg dot klein at ifsam dot lu
-Status: Feedback +Status: Open
 [2010-06-21 10:08 UTC] joerg dot klein at ifsam dot lu
The MySQL directory isn't in PATH at all.
 [2010-06-21 10:14 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-06-21 10:14 UTC] pajoye@php.net
ok, disable GD and mysql and try again. Then enable mysql alone, try again, same with GD (without mysql).
 [2010-06-21 13:44 UTC] joerg dot klein at ifsam dot lu
-Status: Feedback +Status: Open
 [2010-06-21 13:44 UTC] joerg dot klein at ifsam dot lu
The error occurs every time.
I tried again to shorten the code for a reproducible script without success.
I don't think it is an extension error. 
For example one way to run the script without error is to execute the file from a different directory:
error: 
F:\daten\dir1234567890>"C:\Program Files\Apache Group\Apache\php-bin\php.exe" "f:\daten\dir1234567890\upload_pending.php"

no error: 
F:\daten\dir>"C:\Program Files\Apache Group\Apache\php-bin\php.exe" "f:\daten\dir1234567890\upload_pending.php"

Another possibility is to remove a bunch of lines or only change the path of a single require statement. After hours of research again I was not able to find some similarities. It's very strange.

I have found bug #47766 where the reporter had pretty much the same problem.
 [2010-08-08 16:22 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-08-08 16:22 UTC] pajoye@php.net
Please try using 5.3.3 final.

If it still crashes, please provide a small (really small w/o external dependencies) reproduce script.
 [2010-08-18 14:27 UTC] joerg dot klein at ifsam dot lu
-Status: Feedback +Status: Assigned -PHP Version: 5.3.2 +PHP Version: 5.3.3
 [2010-08-18 14:27 UTC] joerg dot klein at ifsam dot lu
I tried again with 5.3.3 final. The same script which produces the error in 5.3.2 works fine, but with some minimal changes (e.g. remove a comment line) the error occured again.
A small reproduce script seems to be impossible. I also tried some different configurations. The result: adding just a comment line in the php.ini let the error disappear.
 [2010-08-18 14:41 UTC] pajoye@php.net
-Status: Assigned +Status: Feedback
 [2010-08-18 14:41 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2011-03-18 10:11 UTC] joerg dot klein at ifsam dot lu
-Status: Feedback +Status: Assigned -PHP Version: 5.3.3 +PHP Version: 5.3.6
 [2011-03-18 10:11 UTC] joerg dot klein at ifsam dot lu
I tested 5.3.6 VC9 today. The crash is still there, but it occurs in another file. I just removed one comment line and the file works without a problem!

As I Stated in my last post, it is impossible to write a short reproduceable script. Even when it crashes on my site, it won't do on your site.
 [2011-03-18 10:14 UTC] pajoye@php.net
-Status: Assigned +Status: Feedback
 [2011-03-18 10:14 UTC] pajoye@php.net
Please provide a new backtrace then, if it crashes somewhere else.

But I still have little clue about what's happening :)
 [2011-03-18 13:46 UTC] joerg dot klein at ifsam dot lu
-Status: Feedback +Status: Assigned
 [2011-03-18 13:46 UTC] joerg dot klein at ifsam dot lu
Thread 0 - System ID 736
Entry point   php_cgi!mainCRTStartup 
Create time   18.03.2011 12:18:32 
Time spent in user mode   0 Days 0:0:0.31 
Time spent in kernel mode   0 Days 0:0:0.156 


Function     Arg 1     Arg 2     Arg 3   Source 
php5ts!zend_register_internal_class_ex+ba7     003f5098     100e1075     01864590    
php5ts!_efree+2e     01864590     003f2918     1021e045    
php5ts!closelog+55     101d7ba4     00000001     00000013    
php5ts!zm_deactivate_syslog+5     00000001     00000013     003f2918    
php5ts!zm_deactivate_basic+e4     00000001     00000013     003f2918    
php5ts!module_registry_cleanup+1b     0198d1b8     003f2918     003f2918    
php5ts!zend_hash_reverse_apply+3f     1058b280     10006640     003f2918    
php5ts!zend_deactivate_modules+61     003f2918     00000002     003f2918    
php5ts!php_request_shutdown+235     00000000     0040a4c8     00000001    
php_cgi!main+e89     00000002     003f3f30     003f2f80    
php_cgi!memset+160     00000000     00000000     7ffdd000    
kernel32!ProcessIdToSessionId+209     00406a7a     00000000     00000000    




PHP5TS!ZEND_REGISTER_INTERNAL_CLASS_EX+BA7In php-cgi__PID__932__Date__03_18_2011__Time_12_18_35PM__387__Second_Chance_Exception_C0000005.dmp the assembly instruction at php5ts!zend_register_internal_class_ex+ba7 in C:\php\php5ts.dll from The PHP Group has caused an access violation exception (0xC0000005) when trying to read from memory location 0x6aebadf8 on thread 0

Module Information 
Image Name: C:\php\php5ts.dll   Symbol Type:  PDB 
Base address: 0x10000000   Time Stamp:  Thu Mar 17 11:41:09 2011  
Checksum: 0x005a6b72   Comments:   
COM DLL: False   Company Name:  The PHP Group 
ISAPIExtension: False   File Description:  PHP Script Interpreter 
ISAPIFilter: False   File Version:  5.3.6 
Managed DLL: False   Internal Name:  PHP Script Interpreter 
VB DLL: False   Legal Copyright:  Copyright © 1997-2010 The PHP Group 
Loaded Image Name:  php5ts.dll   Legal Trademarks:  PHP 
Mapped Image Name:     Original filename:  php5ts.dll 
Module name:  php5ts   Private Build:   
Single Threaded:  False   Product Name:  PHP 
Module Size:  5,75 MBytes   Product Version:  5.3.6 
Symbol File Name:  C:\php\php5ts.pdb   Special Build:  &
 [2011-03-29 07:32 UTC] joerg dot klein at ifsam dot lu
If it helps you to track down the problem, I can give you some more backtraces. For example using pear
 [2011-08-19 09:07 UTC] joerg dot klein at ifsam dot lu
I just updated to 5.3.7 and still get erros from the command line. 
This time I did some additional testing. I run some files with the different SAPIs (php.exe, php-cgi.exe, php-win.exe). 
One file runs fine with php-cgi.exe and get errors with php.exe and php-win.exe. 
Another file get an error with php-cgi.exe and runs fine with php.exe and php-win.exe.
Both files run fine with the Apache SAPI (php5_apache2_2.dll).
 [2011-09-01 00:52 UTC] mattficken@php.net
I can't download your reproduce script from http://ifsam.net/test.php
 or http://ifsam.net/test.zip.

Both links return an HTTP404 error.

Can you provide a new reproduce script or new link to it?

Also, are you sure that the PHP release and the mysql and gd2 extensions are all compiled with VC9?

Also, would you provide the exact Windows Server version you are using (run 'winver')?
 [2011-09-01 08:03 UTC] joerg dot klein at ifsam dot lu
You don't need these files, because there is no real reproduce script. On every PHP release the results are different.
For the current release 5.3.8 just start pear "pear list" and PHP crashes.

All extensions I use are from the latest release.

I am on Windows Server 2003 SP2 Version 5.2.3790
 [2011-09-01 08:19 UTC] pajoye@php.net
-Status: Assigned +Status: Feedback
 [2011-09-01 08:19 UTC] pajoye@php.net
Then it is definitively a configuration problem.

To confirm it, run php -n somescript.php and it should work (as long as the script 
do not use any non loaded extension.
 [2011-09-01 08:30 UTC] joerg dot klein at ifsam dot lu
-Status: Feedback +Status: Assigned
 [2011-09-01 08:30 UTC] joerg dot klein at ifsam dot lu
Why should it be a configuration problem? The system runs fine with the same configuration for a long time. Starting with PHP 5.3.2 the errors occurs.
 [2011-09-01 08:42 UTC] pajoye@php.net
-Status: Assigned +Status: Bogus
 [2011-09-01 08:42 UTC] pajoye@php.net
You certainly messed up with the DLLs, having old version sill installed or 
something similar.
 [2011-09-01 09:53 UTC] joerg dot klein at ifsam dot lu
I checked the DLLs. There are no old version in the system PATH available. I have the problem on two different servers and I am checking my servers for over a year for a misconfiguration.

How would you explain my comment form 2011-08-19 09:07?
It is the same script using the same configuration using different SAPIs!
 [2011-09-01 09:57 UTC] pajoye@php.net
Different php.ini used, different PATH, etc.

Also please note that I do not understand why you want the TS builds to be used 
with FastCGI. Please use only the NTS builds for FastCGI.
 [2011-09-01 10:04 UTC] joerg dot klein at ifsam dot lu
only one php.ini
no different path in the system PATH variable or in php.ini

I use the TS builds because I use it with apache sapi mainly and for some scheduling tasks I use cli.
 [2012-04-26 09:02 UTC] joerg dot klein at ifsam dot lu
-Operating System: win32 only - Windows Server 2003 +Operating System: win32 only-Windows Server 2003/8 -PHP Version: 5.3.6 +PHP Version: 5.3.10
 [2012-04-26 09:02 UTC] joerg dot klein at ifsam dot lu
I installed a fresh server 2008R2 and I get the same errors.
Setting register_globals to off seems to solve the problem. I set up two php.ini. One with register_globals=on for the webserver and one with register_globals=off for the cli. 
I got no error so far.

So the problem is still there, but it seems to work with a workaround!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC