Help - Search - Members - Calendar
Full Version: How can I disable PHP from a site in cpanal?
The Planet Forums > Control Panels > cPanel/WHM
sdhost
How can I disable PHP from a site in cpanal?

in other way

asdu.com not to be support it by php

thanks for your help
thedude
Edit the httpd.conf file(make a backup first).

Find the virtual host lines for the host your disabling PHP access for.

Anywhere in between the <virtualhost> </virtualhost> tags add.

AllowOveride all
php_flag engine off


That should disable PHP for that specific site.
sdhost
QUOTE (thedude @ Jan 29 2008, 10:25 PM) *
Edit the httpd.conf file(make a backup first).

Find the virtual host lines for the host your disabling PHP access for.

Anywhere in between the <virtualhost> </virtualhost> tags add.

AllowOveride all
php_flag engine off
That should disable PHP for that specific site.



thanks you
can you explain it in steps please I am new in the hosting and linux
thedude
First of all you need to get to your httpd.conf file.

This is normally in

/etc/httpd/conf/httpd.conf

though if its not there, you can do a

whereis httpd.conf

Once your in that directory use your favorite editor to open the file.

I prefer nano "nano httpd.conf" or you might use vi "vi httpd.conf"

scroll down once your in that file...your looking for something similiar to the following:

It will start with the <virtualhost> tag.

CODE
<VirtualHost xxxxxxxxx>
ServerAlias xxxx.com
ServerAdmin webmaster@xxx.com
DocumentRoot /home/reckguil/public_html
BytesLog domlogs/xxxx.com-bytes_log
User xxxxx
Group xxxxx
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        php5_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
    </IfModule>
ServerName www.xxxxxxxxx.com


User xxxxx
Group xxxxxxx
CustomLog /usr/local/apache/domlogs/xxxxxxx.com combined
ScriptAlias /cgi-bin/ /home/reckguil/public_html/cgi-bin/
</VirtualHost>


add the code right after the <virtualhost> tag...so..

Mine starts off like this:

after modifying the file to turn off php it would look like this

CODE
<VirtualHost xxxxxxxxx>
ServerAlias xxxx.com
ServerAdmin webmaster@xxx.com
DocumentRoot /home/reckguil/public_html
BytesLog domlogs/xxxx.com-bytes_log
User xxxxx
Group xxxxx
AllowOveride all
php_flag engine off
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        php5_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/reckguil/:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
    </IfModule>
ServerName www.xxxxxxxxx.com


User xxxxx
Group xxxxxxx
CustomLog /usr/local/apache/domlogs/xxxxxxx.com combined
ScriptAlias /cgi-bin/ /home/reckguil/public_html/cgi-bin/
</VirtualHost>


If that doesn't work take out the AllowOveride all and just leave php_flag engine off in there.

Once you have the file modified do a service httpd restart or /usr/sbin/httpd restart

Remember BACKUP YOUR HTTPD.CONF FILE BEFORE YOU MODIFY IT!!!!
James Jhurani
Just to offer another idea... it may create entries in the error log... but if your using suexec then you can just set an acl on the php binary for that particular user. I would be curious to see how good or bad that worked.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.