Is there any way to enable automatic highlighing of php source files (.phps extension)?
In a non-suexec environment it’s enabled by adding:
AddType application/x-httpd-php-source .phps
to /etc/apache2/mods-available/php5.conf
Thanks!
Is there any way to enable automatic highlighing of php source files (.phps extension)?
In a non-suexec environment it’s enabled by adding:
AddType application/x-httpd-php-source .phps
to /etc/apache2/mods-available/php5.conf
Thanks!
Depending on your setup – in the individual domains listed in /etc/apache2/sites-enabled/SITENAME, there may be a number of sections such as:
[code:1]
AddType application/x-httpd-php5 .php5
AddType application/x-httpd-php4 .php
[/code:1]
Try adding the .phps type to one of them, restart Apache, and see if that does the trick.
-Eric
On the off chance that anyone else is looking for a solution to this, I was able to solve it by creating my own highlight script, which has the added benefit of generating a complete & valid HTML 4.01 page:
Services > Configure Website > Edit Directives and add (somewhere after "RewriteEngine on"):
RewriteCond %{REQUEST_URI} .phps$ [NC]
RewriteCond %{REQUEST_URI} !^source.php
RewriteRule ^(.*)$ /source.php?file=$1 [L]
/home/whatever/public_html/source.php:
<?php
$file = isset($_REQUEST[‘file’]) ? (’/’ . trim($_SERVER[‘DOCUMENT_ROOT’], ’ /’) . ‘/’ . trim(str_replace(’…/’, ‘’, $_REQUEST[‘file’]), ’ /’)) : ‘’;
if (strlen($file) > 5 && substr($file, -5) == ‘.phps’ && file_exists($file)):
?>
The requested URL <?php echo htmlentities($_SERVER['REQUEST_URI']); ?> was not found on this server.
<?php endif; ?>I have tried various combinations of the following, in the <Directory …public_html> section and in the <VirtualHost…> section:
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php5 .phps
AddHandler fcgid-script .phps
AddHandler application/x-httpd-php-source .phps
I even tried creating an alternate fcgi wrapper script that passed the -s switch to the php binary.