1. Make the file cgi.php in ~/public_html/ directory.
2. Enter the following line in cgi.php file

################################################## ############
#!/bin/sh
exec /usr/local/cpanel/cgi-sys/php5 -c /home/username/php.ini
################################################## ############

3. change the permission of cgi.php to executable and change the ownership of that file to that of domain user
chmod 744 cgi.php
chown user.user cgi.php

4. Create the custom 'php.ini' file under '/home/username/' and edit the flags in this file according to the requirement.

5. change the ownership of php.ini to that of domain user

chown user.user /home/username/php.ini

6. Add the following lines to .htaccess

Options All -Indexes
AddHandler application/x-httpd-php5 .php
Action application/x-httpd-php5 /php.cgi

7. Take http://domainname/phpinfo.php and see the flags are on/off ??