logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Help with mod_fcgid on Win 2016
Author
sam452



Joined: 19 Dec 2016
Posts: 23
Location: US, Nashville

PostPosted: Tue 24 Sep '19 0:11    Post subject: Help with mod_fcgid on Win 2016 Reply with quote

We are about to go live running php 7.2.20 NTS, Apache 2.4 downloaded from here, 48gb RAM.
We're getting Apache 500 errors, mostly due to timeouts. But with a 48gb server, I would think that we have resources that pages should load in under 2-1/2 minutes. The app is Drupal 8.7, pruning out the development modules.

Windows NT myserver 10.0 build 14393 (Windows Server 2016) i586
MSVC15 (Visual C++ 2017)
x86
CGI/FastCGI
PHP API => 20170718
Zend Extension Build => API320170718,NTS,VC15

cgi.fix_pathinfo => 1
fastcgi.impersonate => 0
max_execution_time => 300
max_input_time => 300
max_input_vars => 3000
memory_limit => 512M
post_max_size => 2008M
upload_max_filesize => 2000M

PHPRC => c:\php7
_FCGI_SHUTDOWN_EVENT_ => 1792

$_SERVER['SERVER_SOFTWARE' => Apache/2.4.39 (Win64) OpenSSL/1.1.1c mod_fcgid/2.3.10-dev


Here is my mod_fcgid in my httpd.conf

Code:

LoadModule cgi_module modules/mod_cgi.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

LoadModule fcgid_module modules/mod_fcgid.so
<IfModule fcgid_module>
  FcgidMaxProcesses 300
   FcgidMaxProcessesPerClass 300

   FcgidOutputBufferSize 65536
   FcgidConnectTimeout 250
   FcgidProcessLifeTime 0
   FcgidMaxRequestsPerProcess 0
   FcgidMinProcessesPerClass 0
   FcgidFixPathinfo 0
   FcgidProcessLifeTime 0
   FcgidZombieScanInterval 20
   FcgidMaxRequestLen 536870912
   FcgidIOTimeout 300
   FcgidTimeScore 3
   FcgidBusyTimeout 300

   FcgidPassHeader Authorization

   FcgidInitialEnv PHPRC "C:\\php7"
   FcgidInitialEnv PATH "C:\\php7;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
   FcgidInitialEnv SystemRoot "C:\\Windows"
   FcgidInitialEnv SystemDrive "C:"
   FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
   FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
   FcgidInitialEnv windir "C:\\WINDOWS"
   <Files ~ "\.php$">
      Options Indexes FollowSymLinks ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper "C:/php7/php-cgi.exe" .php
   </Files>
</IfModule>



I've read, and re-read, James Blond's post configuring php and Apache 2.4.
I must be missing an important piece, so how to make Apache run like it does on my other Drupal 8.7 apps in Linux with less RAM.[/code]
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 24 Sep '19 11:01    Post subject: Reply with quote

That error is from

modules/fcgid/fcgid_proc_win.c
line 34 and or line 98.
The comment in line 97 says "Pass the finish event id to subprocess"

That that is form the function proc_spawn_process()

The error number 1792 is that the process failed start.

Do you have more information in the windows event log about that error? More info in the apache error log?
Back to top
sam452



Joined: 19 Dec 2016
Posts: 23
Location: US, Nashville

PostPosted: Tue 24 Sep '19 14:02    Post subject: Error logs Reply with quote

Yes, certainly.
I can add that I'm using
mod_fcgid-2.3.10-win64-VS16.
Should have thought to add that.

Apache error:
Code:

 mod_fcgid: read timeout from pipe, referer: https://
[Mon Sep 23 16:28:25.558415 2019] [core:error] [pid 14124:tid 1136] [client 10.100.204.13:51813] End of script output before headers: index.php, referer: https://
[Mon Sep 23 16:28:49.983937 2019] [fcgid:warn] [pid 14124:tid 1188] [client 10.100.204.13:63697] mod_fcgid: read timeout from pipe
[Mon Sep 23 16:28:49.983937 2019] [core:error] [pid 14124:tid 1188] [client 10.100.204.13:63697] End of script output before headers: index.php
[Mon Sep 23 16:28:53.544235 2019] [fcgid:warn] [pid 14124:tid 1124] [client 10.100.204.13:63703] mod_fcgid: read timeout from pipe
[Mon Sep 23 16:28:53.544235 2019] [core:error] [pid 14124:tid 1124] [client 10.100.204.13:63703] End of script output before headers: index.php
[Mon Sep 23 16:29:01.813242 2019] [fcgid:warn] [pid 14124:tid 1164] [client 10.100.204.11:60436] mod_fcgid: read timeout from pipe

and
Code:

[Mon Sep 23 16:38:44.071590 2019] [fcgid:warn] [pid 14124:tid 1192] (138)Unknown error: [client 10.100.204.12:51981] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function, referer:
[Mon Sep 23 16:53:52.439167 2019] [fcgid:warn] [pid 14124:tid 1072] [client 10.100.204.12:63396] mod_fcgid: read timeout from pipe, referer:
[Mon Sep 23 16:53:52.439167 2019] [fcgid:warn] [pid 14124:tid 1072] (138)Unknown error: [client 10.100.204.12:63396] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function,

relevant portions of php error log:

PHP Notice: Unknown: file created in the system's temporary directory in Unknown on line 0
And there are some other PHP warnings that I will resolve in the meantime to eliminate those variables.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 24 Sep '19 16:12    Post subject: Reply with quote

FcgidProcessLifeTime is twice in the config ;)

increase the values of
Code:

FcgidIOTimeout
FcgidBusyTimeout
FcgidConnectTimeout
FcgidIdleTimeout


You might also need to tune some settings about timeout in the php.ini file.

Code:

max_execution_time
max_input_time
post_max_size
upload_max_filesize
default_socket_timeout


You should set sys_temp_dir like C:\php\tmp

It also helps to enable load errors from extensions
Code:

display_startup_errors = On
Back to top
sam452



Joined: 19 Dec 2016
Posts: 23
Location: US, Nashville

PostPosted: Tue 24 Sep '19 23:49    Post subject: Reply with quote

Yes, thank you, I've struck the duplicate ProcessLifetime and set my php_temp as indicated. I've been moving up the values for timeouts on httpd.conf and the corresponding php.ini as well from reading other posts in this forum, hoping that 300 (five minutes?) will be enough, but really, should users have to wait that long for a somewhat complex POST on a page? Heck, why not set it for ten minutes and potentially make customers wait up to that limit?
Of course, a legitimate response could be that my Drupal code sucks, or some variant of that, could be offered. But I've got several Drupal installs, but this is my only Drupal 8 on Windows which is why I'm here. I'm wondering if my Windows setup could put more of its resources into Apache/PHP to make it run faster, so that timeouts wouldn't need to be the first recourse.

From what I read here, other PHP variants like FPM, where I believe I could spawn several PHP threads to handle isn't going to work with PHP on Windows? This is a WAMP setup with MySQL taking a small amount of the RAM on this machine, so it shouldn't be waiting for the database.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 25 Sep '19 13:03    Post subject: Reply with quote

Yes, those values are seconds.

I didn't wanted to say it, but drupal is slow and on windows even slower than on linux based systems.

What helps to increase the speed is to enable opcache and run the session data in redis. Turning on opcache is quiet easy.
Back to top
sam452



Joined: 19 Dec 2016
Posts: 23
Location: US, Nashville

PostPosted: Wed 25 Sep '19 14:17    Post subject: NTS vs TS Reply with quote

Your suggestion to add redis, since I have the resources, is the approach I'm going to attempt. Searching this forums, I saw your post using it successfully and link to windows.php.net.

The PHP community suggests to use thread-safe builds of PHP if I'm going to use Apache. That prompted me to return again to your https://www.apachelounge.com/viewtopic.php?t=2394 here which says to use the NTS if I'm using PHP as a module. In my instance, am I using PHP as a module, since I'm pulling in mod_fcgi? In that same windows.php.net page, NTS is recommended for PHP used FastGCI protocol. I'm assuming mod_fcgi is a modification of FastCGI?
I've learned from experience that all things must align within PHP on Windows (can't mix/match 32-bit, TS, VC builds and all its extensions). I know using NTS on the previous Windows 2008 has worked well for Drupal 7.
Is there a discussion elsewhere on Apachelounge about this? It didn't show up in my searches.
Given my instance, should I have gone the TS route?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 26 Sep '19 9:13    Post subject: Reply with quote

TS = Thread safety and that comes to a price for performance. It is not too much of a difference, but noticeable. Yes mod_fcgid is module f(ast)cgi demon. There a several acronyms around for different modules that implement that protocol.

With the use of mod_fcgid and not loading mod_php aka php7apache2_4.dll you can mix all flavors of 32bit and 64 bit, NON Thread safe and thread safe of PHP with any version of Apache. They don't need to have the same VC version. And you can mix PHP versions within vhosts and directories.


From a long time ago https://www.apachelounge.com/viewtopic.php?t=3430

https://www.apachelounge.com/viewtopic.php?t=6615

And https://pastebin.com/raw/eJTSmUsw
Back to top


Reply to topic   Topic: Help with mod_fcgid on Win 2016 View previous topic :: View next topic
Post new topic   Forum Index -> Apache