Postings by Hemant Chaudhary

PHP-CGI with Apache-2.4.37

Hi All,

I want to use my php scripts using mod-cgi.

AddHandler application/x-httpd-php7 php
AddHandler application/x-httpd-php7 .php

and my first.php is like

header('Content-Type: text/html');
print "hello php"

But when I am sending request from browser, my php page got displayed
there instead of content of php page.

Permission of php file is -rwxr-xr-x

Please let me know what am I missing ?



ThreadsPerChild in apache-2.4.37

Hi All,

1) I am using apache-2.4.37 and found that when I am setting
ThreadsPerChild to 5 or 10, it is not creating that number of threads.
Still it creates default threads i:e 25 in debug mode (-X) option.
Whether this parameter doesn't work in debug mode or any issue in
apache-2.4.37 ?

2) I am not able to handle SIGTERM signal in apache server when using
worker module whereas it is possible in prefork module when starting in
debug mode (-X).
While going thorough the code, I came across this snippet :

/* !one_process */
/* remove SIGTERM from the set of blocked signals...

Doubts in apache-2.4.37

Hi Team,

I have following doubt, please help me to understand

1) I am using worker MPM and according to architecture, each child process
creates one worker listener thread which has mutex and listens on the port.
If I am using two ports 80 and 443 then whether each child creates two
listener thread to listen on each port(80 and 443) or it will create only
one listener thread.

2) When mod_cgi forks the another process and sends the response back to
client then the communication between http process and forked process
happens through pipe or socket.

3) When we proxy https request to backend

Graceful shutdown of apache


I am not able to shutdown apache gracefully if I am starting apache in
debug mode i:e (./httpd -X) with worker mpm. I am sending kill -term PID to
httpd process. wherease the same command is working with prefork.

How should I stop worker mpm if started in debug mode ?


Openssl-1.1.1 with apache-2.4.29


I am using openssl-1.1.1 with apache-2.4.29 so that I can use tlsv1.3 in my
server. I am able to build but when I am starting the server
with SSLProtocol TLSv1.3, server is not starting and giving the
error message "SSLProtocol: Illegal protocol 'TLSv1.3'

Does apache 2.4.29 supports openssl-1.1.1 for tlsv1.3 support ??


Cleanup in apache

Hi All,

I am using apache-2.4.25 and apr-1.5.2.
When I am using mod_autoindex for indexing of icons directory, after
serving the request the process gets crashed.

I debugged and checked that it was getting crashed
from apr_pool_cleanup_kill ().
The line which causes the crash is "c->data == data && c->plain_cleanup_fn
== cleanup_f".

Please help me out the reason or this crash. Does anybody had this issue


Issue while listing Directory using mod_autoindex

Hi All,

When I am trying to list directory in apache. My process get killed and I
was not able to see directory. During debugging I have seen that
"apr_dir_close(thedir);" apr_dir_close in function index_directory is
killing my process. So I have commented this function from index_directory.

After commenting, I am able to see the listing of directory but after
listing my directory process is getting killed again.

Get request of large file size greater than 100KB

Hi All,

I am trying to access large file(get request) of large file. This is
working properly if size of file is less than 52KB. But size greater than
52KB is giving me error 4022.

I have debugged and come to know that writev function can write maximum
upto 52KB only. Therefore I changed the default value of
THRESOLD_MAX_BUFFER to 42KB so that my writev will not reach to 52KB.
THRESOLD_MAX_BUFFER to 42KB helps me to solve the issue for PUT request.

But in get request while accessing large file, size of brigade crosses
52KB. As 52KB is greater than THRESOLD_MAX_BUFFER(42KB).

Auto-indexing of directory

Hi All,

I want to see the content of directory. I am able to access particular file
of the directory but when I am accessing whole directory then my process is
getting killed. Response is 200 for both the cases.

Non Blocking write in apache

Hi All,

I am using proxy_http to proxy my request to tomcat from apache. But in
non-blocking call it is not working properly(timeout issue). I am using the
default timeout i:e 60 sec.

When writev returns -1 with errorno==4101, it should wait and then again
try for write.
while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK)
&& (sock->timeout > 0)) _____ code snippet from

In debugging I have checked that sock->timeout is equal to 0.

Message buffer in Apache Web Server

Hi All,

I want to send 1MB of data of request at a time. For this I want to use
buffer in proxy_http. By default we can send 8192(8kb) of data at a time.

I have used ProxyIOBufferSize and BufferSize, but still it is sending 8192

I tried to set these value to 512, so that it will send 512 Bytes at a
time. But again it is sending more than 512 Bytes.

How should I configure so that it can buffer the message till reaches the
buffer size or request is complete.


Buffer in apache

Hi All,

I want to use buffer of 512B in apache . I am using mod_proxy_http to send
request to tomcat and have set ProxyIOBufferSize 512.

But it is sending message to tomcat with size greater than 512B.

How should I control apache in proxy so that it will send message and
receive with max buffer size of 512B.


How to use fcgistarter in apache

Hi All,

I tried to run my perl on port 8070 and proxy my request to port using

I am using the following command
./fcgistarter -c /usr/bin/perl -p 8070

But none of the process gets started on port 8070.

Please help how to use fcgistarter, so that I can start python or perl on
some port and proxy request to it.


Test Functionality of Apache web server

Hi All,

Do we have any test suite for unit testing of apache source code?? I have
taken open source code and build it. I want to test whether all
functionalities is working or not.

Any third party which provides test?


PHP-7.2.5 with Apache-2.4.25


I was using mod_php of php-5.5.37 with apache-2.4.25 and it was working
fine. I upgraded the php to php-7.2.5. But after upgrade, mod_php is not
able to unload properly.

Does anybody also face the same issue.


Rotate logs in apache-2.4.29

Hi All,

I am trying to use rotatelogs in my webserver, but unable to do that.
Please help me to know where I am going wrong.

CustomLog "|/bin/rotatelogs logs/httpd_log 60" combined

(4002)No such file or directory: AH00104: unable to start piped log program
' /bin/rotatelogs /logs/httpd_log 60'
AH00015: Unable to open logs

I tired for access_log too. But getting the same error.


Running Lua Script using mod_lua


While running lua_script using mod_lua, I am getting this error in
error_log. What does it mean
"PANIC: unprotected error in call to Lua API (core and library have
incompatible numeric types)"


Python and Perl support in Apache

Hi All,

Which of the following is the best way to support python and perl in our
apache and why.

Python - WSGI, CGI, CGID or FCGID.

PERL - mod_perl, cgi, cgid , mod_fcgid, mod_psgi.


openssl-1.1.0 with httpd-2.4.33

Hi All,

I am trying to build openssl-1.1.0 with httpd-2.4.33, everything is working
fine without mod_ssl. But when I am loading mod_ssl, I am getting error
while deloading the module i:e dso_close. Whereas httpd-2.4.33 is working
fine with openssl-1.0.2d.

Does anybody also get this issue ?


Apache supports client initiated renegotiation

Hi Team,

I tried to send request from openssl-1.0.2d to Apache server-2.4.25 for ssl
renegotiation using command "openssl s_client -connect IP:PORT". I got
2283136:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake
failure:s3_pkt.c:656. I checked in error log, error is [client] AH02042: rejecting client initiated renegotiation.

I got SSL_SECURE_RENEG true in my custom log, it means we are supporting
Secure Renegotiation. But how should I enable client initiated ssl
renegotiation ?


Logging in apache

Hi Team,

How apache writes to access_log or error log. Whether it opens File
Descriptor(FD) for each request/connection to write in log file.


How modules are called during request processing phase

Hi All,

If I have two modules mod_A and mod_B. Both has defined a hook handler with
APR_HOOK_MIDDLE then which module will be called first to check handler.
Whether calling of module will be random for each request or it depends
which module is loaded first in httpd.conf.


Writting own module

Hi All,

I am writing my own module just to check process flow.

Scoreboard file


According to Apache documentation, parent and Child processes communicate
with shared memory. But I don't have shared memory, therefore they are
communicating through scoreboard file.

I added " ScoreBoardFile /apache/logs/apache_runtime_status " in httpd.conf
to create file at this location. When I started, apache_runtime_status file
get created at above location. But this file contains only 4 Bytes and
file is not getting updated with load on apache. Then how child and parent
processes are communicating with this 4 Byte scoreboard file?

Apache 2.0 architecture

Hi All,

While Debugging apache, I encountered with following questions. I am unable
to get answers for the following questions, please help to answer them.

Q1. Startup process is reading configuration two times and creating
conftree. Why do we need to read configuration script twice? Is there any
difference in conftree after first and second read of configuration script.

Q2. When we start apache, it starts with startup process and then it
detaches and starts Master/Parent Process. After that Master Process take
control and spawn child processes.

Mutex at run time


I set Mutex to default, sysvsem but when I am checking error_log
AcceptMutex is none.

My httpd.conf:
Mutex sysvsem
Mutex sysvsem mpm-accept

My error_log :
worker.c(1885): AH00294: Accept mutex: none (default: sysvsem)

Where am I going wrong to use mutex ?


Integrate Apache-2.4.25 with tomcat-8.5.23


My apache is running on at location "/home/hemant/apache"
and tomcat-8.5.x is running on at location

To integrate apache with tomcat I used mod_proxy and mod_proxy_ajp.
My httpd.conf looks like this :
<Location /ajp>
ProxyPass "ajp://"
ProxyPassReverse "ajp://"

My server.xml is configured like :
<Connector port="8009" protocol="AJP/1.3" proxyName=""
proxyPort="5643" />

When I am accessing "" then index.html of tomcat
appears, but If I click on any tab

Worker MPM with debug mode

Hi All ,

I added the following patch of code in my worker.c
static void clean_child_exit(int code)

if (one_process) {
prefork_note_child_killed(/* slot */ 0, 0, 0);
+ atexit(apr_terminate);

When I am starting apache with Worker mpm in debug mode and killing the
process with kill -term PID, it is not killing the process.

After send status 200 response, process exited

I started my apache successfully, but when I am sending request from
browser. Getting ERR_NO_RESPONSE in chrome.

I added LogLevel trace7 and collected the error log. What I have found
that, after successful response of requests(status-200), process is

Apache sending Content-Length 0


When I am sending request from browser to client for basic "index.html", I
am getting error that
" Err_EMPTY_RESPONSE " in browser.

When I checked in the error log, found that response content length is 0.

[Tue Dec 05 05:28:15.499282 2017] [core:trace5] [pid 150995199:tid
C:\cygwin64\home\hemant\apache\httpd-2.4.25\server\protocol.c(645): [client] Request received from client: GET / HTTP/1.1
[Tue Dec 05 05:28:15.499445 2017] [http:trace4] [pid 150995199:tid