Re: Install Config for Apache

Hello All,

  I was wondering if it is possible to do a per site php.ini configuration. I am installing osCommerce as a test and developement for a new site I am doing for someone. And it requires register_gloabals to be turned on. But I don't want it turned on for the whole server (All the Sites). How do I do this?

Thanks in Advance,
Michael<br><br>Post edited by: HostHoboGuy, at: 2008/09/27 03:41

You haven’t mentioned if you’re using Virtualmin Professional or GPL. It’s trivial in Professional (any virtual host configured to run PHP under fcgid or CGI gets its own php.ini). If it’s GPL, you’ll need to setup suexec for PHP and add a wrapper script that calls the per-user php.ini.

In short, if you have mod_fcgid installed, you need the following in httpd.conf in the public_html Directory section within the VirtualHost:

AddHandler fcgid-script .php
FCGIWrapper /home/example/fcgi-bin/php5.fcgi .php

And then, in /home/example/fcgid-bin/php5.fcgi:

#!/bin/bash
PHPRC=$PWD/…/etc/php5
export PHPRC
umask 022
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php-cgi

Note that permissions and ownership need to be different to run under suexec. Everything needs to be owned by the domain owner user, and cannot be world or group writable (suexec will never execute anything that has insecure permissions).