Latest blog entry

How to enable allow_url_fopen for a single domain on a cPanel server?

March 26, 2011    |   Posted by admin   |    Category: cPanel Management

The way to enable allow_url_fopen on a phpsuexec and a non-phpsuexec server is different. To enable allow_url_fopen server wide is a security risk, however, you can turn it ON for a single domain incase it is required.

Here how it needs to be done.

  • On a non phpsuexec server:

Goto the /usr/local/apache/conf/ directory,

# cd /usr/local/apache/conf/userdata

create a ‘userdata’ directory if not there and then create a directory with the accounts username inside it. Finally, you have to create a file allowurl.conf in the newly created directory.

The complete path should look like:

# pico /usr/local/apache/conf/userdata/<username>/allowurl.conf

and add the following to the file

<IfModule mod_php5.c>  
php_admin_value allow_url_fopen On 
php_admin_value allow_url_include On 
</IfModule> 

Now, edit the Apache configuration file and scroll down to the VirtualHost entry of the domain. Include the path of the above created file in it, as shown below:

Include "/usr/local/apache/conf/userdata/<username>/allowurl.conf"

Save the file and rebuild the apache configuration

# /usr/local/cpanel/bin/apache_conf_distiller --update 
# /usr/local/cpanel/bin/build_apache_conf 
# /scripts/restartsrv httpd

This will enable allow_url_fopen for that domain.

  • On a PhpSuExec Or SuPHP server:

To enable allow_url_fopen on a SuPHP/PHPSuExec enabled server, copy the server side php.ini OR create a new one under the public_html directory of the domain (OR in the directory where you want to enable allow_url_fopen) i.e.

# cp /usr/local/lib/php.ini /home/<username>/public_html/

and edit the new php.ini to enable allow_url_fopen directive:

allow_url_fopen = On

Save the file and this is it.

BTW, replace “<username>” with the actual username of the domain wherever stated above.

Comments Off on How to enable allow_url_fopen for a single domain on a cPanel server?

How to assign a dedicated IP to a Sub-domain OR Add-on/Park domain?

March 8, 2011    |   Posted by admin   |    Category: cPanel Management

By default, cPanel allows one IP per account, however, in case you wish to assign multiple IPs to an account, say for a sub-domain, you can do so by editing a few files. Follow the below steps:

1) The main configuration file of a domain is stored under the /var/cpanel/userdata/<username>/ directory, so edit the subdomain related file under it

# vi /var/cpanel/userdata/<username>/subdomain.domain.tld

Change the value of “IP” to a dedicated IP and save the file. The add-on and Park domains have their related subdomain files in the same directory.

2) Now, rebuild the Apache configuration for the changes to take affect in the respective VirtualHost entry

# /scripts/rebuildhttpdconf 

3) Restart the Apache webserver

# service httpd restart

4) Add the dedicated IP and sub-domain in the /etc/domainips file to mark the dedicated IP as assigned so WHM won’t be able to assign it to other domains.

dedicatedIP: subdomain.domain.tld

Save the file and rebuild the IP pool

# /scripts/rebuildippool

5) Now, edit the DNS zone file of the main domain (i.e. the domain under which the sub-domain is created) and add an ‘A’ record for the sub-domain to point to the new IP.

# vi /var/named/domain.tld.db

Save the file and restart the ‘named’ service

# service named restart

Allow sometime for the new IP to propagate.

Note: Rebuilding the IP pool will still list the IP as free under the WHM -> IP Function -> ‘Show IP Address Usage’, however WHM wont allow you to assign that IP to another domain.

Comments Off on How to assign a dedicated IP to a Sub-domain OR Add-on/Park domain?