PHP 5 Local

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:


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

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

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


Wild Card DNS

For the DNS, edit the DNS zone file and add the following:

* IN A x.x.x.x

(where x.x.x.x is the IP for the hosting account using the wildcard)

Edit your httpd.conf config file for your web server and add a
server alias wildcard for the host you want to have wildcards:

ServerAlias *

OpenDNS error

change etc/named.conf from:

options {
directory “/var”;
auth-nxdomain no;
pid-file “/var/run/named/”;

to this:

options {
directory “/var”;
auth-nxdomain no;
pid-file “/var/run/named/”;
allow-recursion {; };