March 31, 2015

Force your PHP Scripts to display in source code

PHP htaccess file

Generally, PHP is a server side scripting language. You cannot see your PHP scripts in your source code as PHP out puts are parsed as HTML. But, by using .htaccess file in PHP we can modify the default behaviour of PHP and we can force the scripts to visible in source code. I personally don't recommend to do it in production environment as it creates a security issue but if you are in testing phase you can use it. Okay, enough of the talk let me show you the process.

First open the .htccess file if you don't have one create one by saving the file as .htaccess nothing will be in prefix just simple .htaccess and open the file in code editor and paste the following code.

RemoveHandler cgi-script .pl .cgi .php .py
AddType text/plain .pl .cgi .php .py


That's it now you can see your php in source code. I hope you liked the tutorial. If you have any queries comment below of you can mail me at ething4pc@gmail.com

No comments: