Comments on: suPHP and .phps PHP code highlighting support https://hm2k.org/posts/suphp-and-phps Research and development Sun, 13 Dec 2009 12:29:41 +0000 hourly 1 https://wordpress.org/?v=5.5.1 By: NiLon https://hm2k.org/posts/suphp-and-phps/comment-page-1#comment-190947 Sun, 13 Dec 2009 12:29:41 +0000 http://www.hm2k.com/?p=214#comment-190947 To apache confs add handler for .phps

AddType application/x-httpd-php-source .phps
suPHP_AddHandler application/x-httpd-php-source

then go to suphp.conf and add binaries that handle requests, for source I use wrapper

application/x-httpd-php=php:/usr/bin/php-cgi
application/x-httpd-php-source=php:/tmp/php-cgi-source

/tmp/php-cgi-source is file containing only line:

#!/usr/bin/php-cgi -s

restart webserver and you are good to go

]]>
By: TeeCee https://hm2k.org/posts/suphp-and-phps/comment-page-1#comment-125335 Sat, 06 Dec 2008 11:20:15 +0000 http://www.hm2k.com/?p=214#comment-125335 Hi!

There is some problem with this code…
1.) The highlight_file() is often disabled because the safe_mode = ON setting. This can be eliminatedwith some workaround, since highlight_string() is working in that case…
2.) The substr… strpos… checking is bad, because it splits the string at the first dot in the path!

My version that works on my safe_mode running server:

if ( strtolower(@array_pop(explode(‘.’,$_GET[‘file’]))) === ‘phps’) {
highlight_string(join(”, file($_GET[‘file’])));
}

]]>
By: Zeeshan https://hm2k.org/posts/suphp-and-phps/comment-page-1#comment-88542 Fri, 01 Aug 2008 14:27:21 +0000 http://www.hm2k.com/?p=214#comment-88542 Investigate send_parsed_php_source() in mod_php4/5.c to see how it handles the “application/x-httpd-php-source” handler type or form a second handler (or third handler) in suPHP which specifically points to a PHP CGI that contains the initial param of ‘-s’. Assign “application/x-httpd-php-source” to suPHP’s new handler and any file then given to this PHP CGI binary will output syntax highlighted source code.

]]>