As php5 compiled in the cgi mode customers cannot to use .htaccess directives like php_admin, php_value, php_flag. In phpsuexec setup (for main php) it is overridden by allowing customers place custom php.ini with the variables.

However if you build the php5 as the secondary php it will not have such ability. So how to solve it? To write very simple wrapper to pass php.ini line of the current directory if exists.

The steps to be done after php5 setup.

Moving php5 binary:

mv /usr/local/cpanel/cgi-sys/php5 /usr/local/cpanel/cgi-sys/php5.bin

Then creating wrapper file in the /usr/local/cpanel/cgi-sys/php5 with the following content:

#!/bin/bash

# This will fake the name & path and hide the /usr/local/cpanel/cgi-sys/php5 path!
export SCRIPT_NAME=$REQUEST_URI
export SCRIPT_FILENAME=$PATH_TRANSLATED
export PWD=`echo $PATH_TRANSLATED|egrep -o “(.*?/)”`

if [ -f “$PWD/php.ini” ]; then
exec /usr/local/cpanel/cgi-sys/php5.bin -c $PWD
else
exec /usr/local/cpanel/cgi-sys/php5.bin
fi

Save the file and change the permissons:

chown root:wheel /usr/local/cpanel/cgi-sys/php5*;
chmod 755 /usr/local/cpanel/cgi-sys/php5*;

We are done! By default php5 will use the global php.ini, but if the customer has the own php.ini in its folder php5 will use it instead