Check out the processes running on your server, and after you hit test.php you should see a php-cgi process running as the example user. If you have problems, error_log and suexec_log in /var/log/apache2/ (or /var/log/httpd/) tend to tell you everything you need to know.
An oh yeah, want to use
- on Gentoo, make sure your USE contains: suexec, apache2, cgi, fastcgi, session.
- on Gentoo, "emerge apache php mod_fcgid". On other platforms, consult your docs (or just download mod_fcgid and use apxs to install it. it should be pretty seamless)
- Set up your global configuration. On Gentoo, this is done for you, but make sure this gets loaded into your global apache configuration:
LoadModule fcgid_module modules/mod_fcgid.so
allow from all
- Add a user and group for your first virtual host, test.example.com. call em "example" if you like
- Set up the directory tree for the virtual host:
- Make some files:
hello HTML world!
/* /var/www/test.example.com/test.php */
print("hello PHP world!");
- Copy your php.ini to /var/www/test.example.com/htdocs/fcgi and edit it so that directories are right. All you'll likely need to change is upload.tmp_dir and session.save_path, but you may want to change others.
- Set fcgi to be executable, and make sure permissions are set on it so that it is owned by your test user/group and other users can't mess with it. If things don't work later, this is a frequent culprit
- Set the immutable bit on php.ini and fcgi (you'll need to be using extended file system attributes on your filesystem to do this, check your OS documentation for details) by running 'chattr +i /var/www/test.example.com/htdocs/*'. You'll need to undo this with chattr -i if you want to change these files in the future.
- Set up this host's configuration:
SuexecUserGroup example example
Allow from all
DirectoryIndex index.html index.php
AddType application/x-httpd-fastphp .php
Action application/x-httpd-fastphp /cgi-bin/fphp
FCGIWrapper /var/www/test.example.com/htdocs/cgi-bin/fphp .php
Options +ExecCGI -Includes
allow from all
Redirect Permanent / http://test.example.com/
- Give apache a restart and that should be it!