How to render PHPS files with syntax highlighting under Hive and SuPHP
Knowledgebase Article
}
Knowledgebase Article
Files with the extention .phps unfortunately will sometimes attempt to download in a browser instead of rendering using syntax highlighting. Luckily there is a workaround if you encounter this problem.
To begin, inside the directory with the phps files, create a file named phpsource.php with the following contents:
<?php
if (substr($_GET['file'],strpos($_GET['file'],'.')) == '.phps') {
highlight_file($_GET['file']);
} // End of If
?>
Next, in the same directory's .htaccess file (or create one if none exists) insert the following:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mydirectory/
RewriteRule ^(.+\.phps)$ phpsource.php?file=$1 [L]
</IfModule>
Please note that "mydirectory" in the example should be replaced with the actual directory name you are placing it in. If you are placing it in public_html, then replace the directory name with "/" (without the quotes). So "mydirectory" is relative to your public_html directory itself. Once complete, test one of the .phps files in a browser and it should render correctly with syntax highlighting. Enjoy!
Powered by WHMCompleteSolution