PHP htaccess tips and tricks

Htaccess php tips and tricks for the Apache HTTPD Web Server, mostly these tips show you how to run customized versions with customized php.ini files, I require custom php.ini files because they are so useful!

Even more detailed php tips can be found at custom php.ini tips and tricks

| .htaccess Tutorial Index |

PHP htaccess tips

Setup PHP when run as CGI / suexec

Place your php.ini file in the dir of your cgi'd php, in this case /cgi-bin/, .htaccess might look something like:

AddHandler php-cgi .php .htm
Action php-cgi /

Use a custom php.ini with mod_php or php as a cgi

Article: Custom PHP.ini tips and tricks

PHP run as Apache Module (mod_php)

Add this to your root .htaccess file. Say your php.ini is in folder /

SetEnv PHPRC /

Custom php.ini with wrapper for FastCGI and PHP

You can use FastCGI on php by creating a php binary for cgi execution, then you create a fcgi wrapper script that execs the php using FastCGI

Article: Custom php.ini/FastCGI/DreamHost

export PHPRC=/
exec /
# or
#exec / -c /

htaccess Guide Sections

| .htaccess Tutorial Index |