[Windows] Server 9.1.1 - fastCGI PATH problem + solution

General discussion forum for the Zend Server

[Windows] Server 9.1.1 - fastCGI PATH problem + solution

Postby stev6505 on Tue Oct 17, 2017 11:01 am

This is kind of a bug report, or should help others not wasting hours of their life:

Zend Server 9.1.1.114795
The default MSI installation ("development machine" option) leaves the following configuration entry:

ZENDSERVER\Apache24\conf\httpd.conf
Code: Select all
FcgidInitialEnv PATH "..."


Setting environment variablies using FcgidInitialEnv is silently truncated after 128 characters.
If your PATH is longer than 128 characters, you will have a bad time.

This seems to be an Apache mod_fcgid issue (found by the Perl guys in 2014(!)):
gmod[dot]org/wiki/Recompiling_mod_fcgid_to_avoid_truncated_Perl_library_paths
The problem is that mod_fcgid limits environment variables to 127 characters and will truncate their values if they exceed this.


But you are not forced to use this broken directive.


example:

ZENDSERVER\Apache24\conf\httpd.conf
Code: Select all
FcgidInitialEnv PATH "C:\mysql\bin;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files (x86)\GNU\GnuPG\pub;C:\Program Files\OpenVPN\bin;C:\Program Files\TortoiseSVN\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\ZendServer\ZendServer\share\ZendFramework\bin;C:\Program Files (x86)\ZendServer\ZendServer\bin;%JAVA_HOME%\bin;"


phpinfo(): Environmenth PATH:
Code: Select all
C:\mysql\bin;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files (x86)\GNU\GnuP


In my case I wanted to call Java from PHP using exec()/passthru(), which failed because the PATH which PHP sees has been silently truncated by Apache/FastCGI.


solution:

To workaround this issue remove or comment this directive:

ZENDSERVER\Apache24\conf\httpd.conf
Code: Select all
#FcgidInitialEnv PATH "..."


Now PHP sees the correct PATH environment variable (for the user running the Apache process).


final thoughts:

Please improve the Windows MSI installer:
1. remove the FcgidInitialEnv PATH directive or comment by default, at least for "development" machines
2. let one choose the Apache user account for the services
3. let one choose the default document root


keywords:
Windows, Apache, FastCGI, mod_fcgid, FcgidInitialEnv, length, PATH, httpd.conf
stev6505
 
Posts: 1
Joined: Tue Oct 17, 2017 10:36 am

Re: [Windows] Server 9.1.1 - fastCGI PATH problem + solution

Postby zend_eyalt on Wed Oct 25, 2017 8:03 am

Hi there,

thank you for detailing both your problem and the workaround you found.

We will see if we can compile apache with an higher limit than the 127 characters.

Regarding the 2 other feature requests, they would go to product management for consideration whether they should go into development.

thanks,
Eyal
User avatar
zend_eyalt
 
Posts: 250
Joined: Thu Jan 22, 2009 3:16 pm

Re: [Windows] Server 9.1.1 - fastCGI PATH problem + solution

Postby zend_eyalt on Sun Oct 29, 2017 9:29 am

Just to update that the FcgidInitialEnv issue was indeed addressed (extending the PATH limit to 512 characters) and will be part of the next major ZS release.
User avatar
zend_eyalt
 
Posts: 250
Joined: Thu Jan 22, 2009 3:16 pm

Re: [Windows] Server 9.1.1 - fastCGI PATH problem + solution

Postby jaso3575 on Mon Oct 30, 2017 10:52 am

Homework is a kind of instructional writing that can be described as a complex analytical writing. Buy homework of excessive exceptional written from scratch. All custom homework together with homework essays, homework papers is non-plagiarized.We offer Homework and task Writing help provider online from nicely expert Writers with cash back assure. Pay a person to do my homework task on-line! Order a far-wished writing career to paintings on certainly one of your assignments. We provide homework writing assist online at less costly costs. you can purchase customized original homework from us on all educational disciplines.
WebSource Link: Homework Writing Service | "EssayLounge .com" |
jaso3575
 
Posts: 1
Joined: Mon Oct 30, 2017 10:37 am


Return to Zend Server

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests