The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how can I create static-only accounts in cpanel

Discussion in 'General Discussion' started by dandadude, Nov 20, 2011.

  1. dandadude

    dandadude Active Member

    Joined:
    Apr 14, 2011
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Hi!

    I give an option for my clients to choose a package that can only serve static content (no PHP, no SQL etc).

    Now the SQL part is easy, I allow 0 SQL databases to be created, but disabling PHP is a bit trickier.

    Can someone give me the instructions for creating a user/account that cannot execute PHP scripts? Is this possible? It is ok for me if this would be done through virtualhost modification, because that can be done nicely in Cpanel, but any other ways are welcomed also.

    Thank you,
    Daniel
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Daniel,

    You could put the following include into the user's VirtualHost entry:

    Code:
    RemoveType .php .php4 .php5
    This would disable the ability to use PHP extensions for PHP on the account. Since RemoveType processes before AddType, the user shouldn't be able to override it.

    For includes, you'd want to put this into /usr/local/apache/conf/userdata/std/2/user/include.conf location where std is http, 2 is Apache 2 or Apache 2.2, user is the cPanel username, and include.conf is the name of the include file.

    The file and folders will not exist, so you'd have to create the folders first:

    Code:
    mkdir -p /usr/local/apache/conf/userdata/std/2/user
    Then you would create the include.conf file and put the RemoveType entries into it. You'd then have to check the include works, push the include, distill Apache, rebuild it and restart it. I suggest making a backup of httpd.conf first:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak111122
    The other commands would be:

    Code:
    /scripts/verify_vhost_includes
    /scripts/ensure_vhost_includes --user=username
    /usr/local/cpanel/bin/apache_conf_distiller --update
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    Above, replace username with the cPanel username for the account.

    If everything is working properly at that point, you can try to add a PHP file and it should try to download in a browser without working.
     
  3. dandadude

    dandadude Active Member

    Joined:
    Apr 14, 2011
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Hi Tristan!

    Thank you very much, your answer is very thorough and works great!!!

    THANK YOU!!!

    Daniel
     
Loading...

Share This Page