Activities

March 2013
M T W T F S S
« Jan   Apr »
 123
45678910
11121314151617
18192021222324
25262728293031

Whm/Cpanel : Adding new PHP handler in Apache

One of my client have a server which all the php files are used in diff. file extension . Eg they uses a file testphp.sec to run php script. This file is containing pure php codes but named in different manner to interpret they are using different platform.

Sometimes it might be help to avoid hacking attempt and dishonor crawlers vision.

Whenever I call this file over browser, this file downloaded to my browser. I can not run it over the Apache.

How do I add different files extension to run Php script.

Solution : Edit the file /usr/local/apache/conf/php.conf and add your new extension file type here in the php handler line. Sample line entry is showing below,

eg :

AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml .sec

My php file will look like as below

 root@cpanel01 [~]# vi /usr/local/apache/conf/php.conf
# SuPHP configuration for PHP5
LoadModule suphp_module modules/mod_suphp.so
suPHP_Engine on
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml .sec
<Directory />
    suPHP_AddHandler application/x-httpd-php5
</Directory>

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>