Weblog
A Mark Mayo essay
I read Mark Mayo’s FastCGI, SCGI, and Apache: Background and Future via Duncan
And as a quick note, wanted to say “wow, I wish I had wrote that”.
If you haven’t read it, go. Bookmark it. I think it’s a good one.
More on why later, but with the only thought that I think the entire world should just be straight up http.
·:· Posted 6 January 2006, 06:59 by Jason Hoffman to Apache | Comment? [3]
mod_fcgid
Paul Querna, one of the reasons the Apache web server is still interesting, recommends mod_fcgid (“interesting” as in the retooling of authentication and the event mpm in Apache 2.2 is good stuff, and the RFC for a Perchild-like-MPM should be read by anyone who wants to do a modern web server that does mass virtual hosting).
So for mod_fcgid, he’s right.
I said the same thing about a year ago in various places and sites like Dan’s Hivelogic runs under mod_fcgid/Apache2 here.
We should actually look at rolling it out across all the servers, but I’m not sure it would overcome any file descriptor issues. It might.
For Rails it would just take replacing
AddHandler fastcgi-script .fcgi
with
AddHandler fcgid-script .fcgi
in the .htaccess file.
What’s the difference between this and the upcoming mod_proxy_fcgi, you ask?
The mod_proxy_fcgi just proxies or relays stuff from web server to an independently launched and managed fastcgi process (this is how we do strongspace’s fcgi by the way) while mod_fastcgi has a dynamic process manager: it can launch and control fastcgi processes.
mod_fcgid is better at dynamic fcgi process management than the original mod_fastcgi.
And then as the final bonus question, “how is litespeed’s handling of fastcgi different even from lighttpd and apache?” Hmm ….?
·:· Posted 2 January 2006, 11:54 by Jason Hoffman to Apache | Comment [3]
Why we like php-fastcgi and its flexibility
Unfortunately, php_value in .htaccess are possible only with PHP as an Apache module (not with CGI/FastCGI versions).
So if you’d like to use php-fcgi but still need some flexibility with your php configuration, (since the php-fcgi scripts are just wrappers) you can create php.ini files for whatever feature-set you need, duplicate the wrapper scripts, defining different PHPRC values for each, then use a .htaccess in each of the subfolders to define which one of the wrappers to use with the following directives.
That technical mumbo-jumbo sound confusing? Well, here’s an example (you’ll need to create your own ‘extra’ wrapper/php.ini files) that may help clear the air:
I want to have ~/web/public/subdir1 use session.auto_start and not register_globals, and ~/web/public/subdir2 use register_globals, but not auto-start sessions.
To accomplish this, I duplicate the ~/php-fastcgi/phpX-fcgi script for the version of php you’d like to use (4 or 5) and name them with unique names.
server # cd php-fastcgi
server # ls
php4-fcgi php5-fcgi
server # cp php5-fcgi php5-fcgi_sess_autostart
server # cp php5-fcgi php5-fcgi_reg_globals
server # ls
php4-fcgi php5-fcgi php5-fcgi_sess_autostart php5-fcgi_reg_globals
Then copy the main php.ini for your selected version (/usr/local/etc/php.ini for php5 and /usr/local/etc/php4/php.ini for php4) to a newly created directory (inside ~/etc would be customary)
server # cd ~/etc/
server # ls
dav.digest.groups dav.digest.passwd svn-access.conf svn.basic.passwd
server # mkdir php5_sess_autostart
server # mkdir php5_reg_globals
server # cp /usr/local/etc/php.ini php5_sess_autostart
server # cp /usr/local/etc/php.ini php5_reg_globals
server # ls php5_*
php5_reg_globals:
php.ini
php5_sess_autostart:
php.ini
Edit the php.ini files with your required settings, then finally edit the PHPRC value within the new wrapper scripts:
server # grep ^PHPRC php5-fcgi_sess_autostart
PHPRC="/home/yourusername/etc/php5_sess_autostart"
server # grep ^PHPRC php5-fcgi_reg_globals
PHPRC="/home/yourusername/etc/php5_reg_globals"
Lastly, to actually use our new wrappers, simply add a .htaccess to the appropriate subdirectory with a new AddType declaration to have Apache use the proper wrappers for your php files:
AddType application/x-httpd-fastphp-autostart .php
Action application/x-httpd-fastphp-autostart /php-fastcgi/php5-fcgi_sess_autostart
See our article on Trade Secret #1 for more information on php-fastcgi.
·:· Posted 14 November 2005, 05:42 by Ryan Schwartz to Apache | Like Flexibility? [1]
.textdrive makes us .happy
You’ll all notice that there are some happy little .textdrive files in your logs folders, and your public_html (or web/public on davie) folders that contain the following text:
this file is non-deletable – if you have questions, please contact support@textdrive.com
Now what this file contains is not as important is what it is – a file that you’re not able to delete. That means if you try to delete your logs folder, or your public_html (or web/public) folder, it just ain’t gonna happen.
[pendrell:~] ryanschwartz$ rm -fR logs/ rm: logs/.textdrive: Operation not permitted rm: logs/: Directory not empty
Now something you all should know is that most of the downtime we see here at TextDrive is due to one of two things:
1. People deleting their log or docroot folders.
2. People eating up all of MySQL’s 2GiB of allocated RAM and it dying.
Well, for the most part number 1 is not going to happen any more by accident. If you set up a custom DocumentRoot in the apache module of webmin, then you should know not to delete it. Please don’t. And if you do happen to do so, and it brings down apache for you and the other ~1000 domains on your server, we do reserve the right to enforce the TOS (see point 17 under Client Responsibilities)
That said, we’ll likely give you a freebie or two because we’re nice guys, and try to keep everyone humming along at the speed of TextDrive. Just play nice and fair with your friends in the sandbox and nobody gets a time out.
·:· Posted 31 May 2005, 02:38 by Ryan Schwartz to Apache | Your Thoughts? [2]
RRD and MRTG see see see
This is what lighty’s RRD-output-thingy-moo-doohickey looks like.
This in contrast is the output from mod_watch 4.3 for Apache2 when combined with MRTG.
·:· Posted 19 May 2005, 00:47 by Jason Hoffman to Lighttpd | Comment
←
Recently:
- The weblog is heading over to Joyeur.com
- The Scale with Rails workshops
- By popular demand, the plain FSCK You shirts are out
- Apache 2.2, mod_proxy_balancer and Mongrel
- Apache 2.2 worker on solaris to a remote mongrel
- I made some other web server points over at Joyeur
- Beware the trailing slash in Apache's proxy balancer
- What about Apache to Mongrel for Rails applications?
- Lighttpd versus Litespeed with Mongrel as a backend for Rails applications
- Moving a ZFS filesystem and all of its snapshots from one zpool to another
- Watch Out for Software Updates
- Two simple tips for freezing your rails
- #1 in Google for ZFS snapshots
- I'll be speaking at the Silicon Valley Ruby Conference
- Joyeur and the Dell Selling Machine
- In town for ETech?
- DragonflyBSD porting ZFS
- ZFS Snapshots
- Correction on Zeus versus Litespeed hitting a static image file
- Rails with Zeus and Mongrel or FCGI

