[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How do I correct Application Errors in module php4ts.dll in Apache.exe?

Posted on 2007-10-11
Medium Priority
Last Modified: 2012-05-05
I'm a Windows Server Administrator, but actually a client has a Apache for Windows in a Windows Server 2003 R2.

An event is registered in the application section of Event Viewer, when we got some concurrent users on a apache site (with php based applications):  

Tipo de suceso:      Error
Origen del suceso:      Application Error
Categoría del suceso:      (100)
Id. suceso:      1000
Fecha:            02/10/2007
Hora:            9:37:51
Usuario:            No disponible
Equipo:      DCSERVER2
Aplicación con errores: Apache.exe, versión:, módulo con error: php4ts.dll, versión, dirección de error 0x000c6aa2.

Para obtener más información, vea el Centro de ayuda y soporte técnico en http://go.microsoft.com/fwlink/events.asp.
0000: 41 70 70 6c 69 63 61 74   Applicat
0008: 69 6f 6e 20 46 61 69 6c   ion Fail
0010: 75 72 65 20 20 41 70 61   ure  Apa
0018: 63 68 65 2e 65 78 65 20   che.exe
0020: 32 2e 30 2e 35 30 2e 30
0028: 20 69 6e 20 70 68 70 34    in php4
0030: 74 73 2e 64 6c 6c 20 34   ts.dll 4
0038: 2e 34 2e 34 2e 34 20 61   .4.4.4 a
0040: 74 20 6f 66 66 73 65 74   t offset
0048: 20 30 30 30 63 36 61 61    000c6aa
0050: 32                        2      

Where else i could find log information about this Windows Error.  Do you need any log?

Thanks in advance for your help
Question by:bad3000
  • 2
  • 2

Expert Comment

ID: 20062664
You could look in the apache error log (this can be set in either the server config or VirtualHost definiton).
If the php ini setting log_errors is On then php errors are logged in the apache error log, but i suspect this is a segmentation fault in which case you might not find anything in the apache error logs.
php4 had a lot of bugs causing segmentation faults on windows threaded webservers (some of which i've encounter were related to  preg_match_all() and ereg_replace() or mb_ereg_replace() functions)

You should update to the latest release of php4 and see if the problem persists.

If you are running a publicly available/open source php application you could check out the community forums and see if anyone else has similar problems.

If it's a custom build php application ask the developer(s) to test using a debug build of php and webserver stress test tools.

As a short term fix, you could set ThreadsPerChild 1 for mpm_winnt.c. That will most likely stop the errors from occurring but it will affect performance during high concurrency. To regain some of the lost performance you could increase the MaxClients value but this approach will use more ram compared to threads.

Author Comment

ID: 20071600
I've found this setting on the php.ini
;memory_limit = 128M      ; Maximum amount of memory a script may consume (128MB)

I'noticed that after 128MB Apache.exe also fails, it could happen?  I'm testing now with a Memory Limit of 512M

I'm new to php.ini settings.  Can you explain where are the files that i need to change and how i can set the MaxClients settings, a sample it's good, it's HEX o DEC, how can i write the MaxClient seting?



Accepted Solution

theevilworm earned 500 total points
ID: 20072577
I don't think this is related to the memory_limit setting. If you were hitting the memory limit, php would not cause an application error and you would be able to see the error message in the apache error logs (log_errors is enabled by default in php windows installations)
The default apache 2.0 instalation path is C:\Program Files\Apache Group\Apache2.
You should check C:\Program Files\Apache Group\Apache2\logs\error.log and C:\Program Files\Apache Group\Apache2\error_log. If memory limit was hit then you will find Fatal Error entries in error_log.
(Note, error_log is the default error log set up by apache, it can - and usually is - changed in VirtualHost directives in httpd.conf)

The MaxClients and ServerLimit directives are normally set in httpd.conf ( C:\Program Files\Apache Group\Apache2\conf\httpd.conf) but i was misinformed because mpm_winnt does not spawn more than 1 child process and does not support these settings. You could increase ThreadsPerChild to achieve something similar to the MaxClients directive. Setting ThreadsPerChild to 1 (as recommended by me in my first post) will reduce the performace of your webserver to a crawl. Search for <IfModule mpm_winnt.c>. In apache 2.2 these settings are no longer in a <IfModule> directive because mpm_winnt is the only multi processing module available for windows. To

Hitting memory limit should not cause an application error and should not cause apache to crash. A memory limit of 512mb for a php application is way too much and apache will try to allocate this much memory for each php execution thread. memory_limit is not a global setting affecting the overall php memory usage, it refers to the memory limit of each php thread/process. 512mb is a lot of memory to be used by a script generating a html page but it might be required, i don't know what your application is doing (just seems excessive), but during high concurrency if your scripts do use up 512mb of ram each, you will need a lot of ram. The apache server should not normally fail if a php script has hit memory limit. I do not know what would happen if apache would try to allocate more memory than maximum memory available on the system.

If there's nothing in the error logs related to the crash, to find out wich script file is causing the error check the access logs and test most accessed script files with ab (Apache Bench, installed by default with apache in C:\Program Files\Apache Group\Apache2\bin\ab.exe or abs.exe for ssl).

ab.exe -c 10 -t 30 htttp://domain/script.php will hammer script.php with requests for 30 seconds with 10 concurrency. Replace domain with your domain name and script.php with the script file you want to test. you can also add get parameters, please see the ApacheBench documentation on how to test post requests. if you only have one site configured for apache you can test with localhost instead of public domain name. You can increase concurrency and find out exactly what part of your php application is causing the crash.

I'm sorry about my initial uninformed statement about the MaxClients directive. I assumed it was the same  for all multiprocessing modules.

I strongly recommend you update to php 4.4.7 several segmentation fault errors have been fixed since 4.4.4 - http://www.php.net/ChangeLog-4.php - (i'm assuming this is the version you are using based on the error report php4ts.dll version number)

Author Comment

ID: 20272746
We actually downloaded and installed the php 4.4.7 but we need to wait until end-of-month processing to see if the application error ocurrs.

We set the memory limit to 48M on the previos month processing and we noticed that the number of times that the application error was reduced from 10 by day to just once or two by day.

I didn't review the logs yet, we'll wait until this month processing, we enabled the logs as you instructed.  So we are testing, we'll use the stress tool tonight




Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses
Course of the Month19 days, 6 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question