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 /askapache.com/cgi-bin/php5.cgi
Use a custom php.ini with mod_php or php as a cgi
PHP run as Apache Module (mod_php)
Add this to your root .htaccess file. Say your php.ini is in folder /askapache.com/ini/
SetEnv PHPRC /askapache.com/ini
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
#!/bin/sh export PHP_FCGI_CHILDREN=3 export PHPRC=/askapache.com/ini exec /askapache.com/cgi-bin/php.cgi # or #exec /askapache.com/cgi-bin/php.cgi -c /askapache.com/ini/php.ini