View Single Post
Old 30th December 2012, 16:50
fatbear fatbear is offline
Join Date: Jul 2010
Location: Raleigh, NC US
Posts: 42
Thanks: 4
Thanked 9 Times in 4 Posts
Default Changing Umask Leads to mod_fcgid errors

To enhance security, I changed my system umask in /etc/profile to 007. After this, creating new websites would no produce websites that could use PHP. I got errors such as:

[Sun Dec 30 09:13:25 2012] [warn] [client] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun Dec 30 09:13:25 2012] [error] [client] Premature end of script headers: index.php
I tracked the problem down to the entries in the /var/www/php-fcgi-scripts directory that were now created with 750 instead of 755 mode. Once I manually changed the entries back to 755, everything worked again.

In looking at the code, I see in:


on line 958:

exec('chmod 755 '.$fcgi_starter_script);

That is fine for modifying the mode of the .php-fcgi-starter file, but the directory is created on line 925 and is created with the default umask. That's the problem. So, before this line, I inserted:


and all worked again.

Perhaps this umask should be in a more global or earlier location. Can any of the devs suggest a more permanent fix?
Steve Amerige, Fat Bear Incorporated
Server Leasing | Web Software Development | User Experience & Graphic Design
Managed Services, Website, Java, and Source-Code Hosting
Did my post help you? Click the Thanks button!
Reply With Quote
Sponsored Links