georgeocrawford
05-08-2004, 06:21 AM
Hi,
I'm working on a complicated set of PHP scripts on my home machine at the moment. When at a friends house demonstrating one of them, I wanted to show him the source of a script. Sure, I could have SSH'ed in, but I couldn't be bothered - I needed a quick demo.
I thought it would be really nice to have a *.phps version of every *.php file I have in my webserver. I am not bothered about secret scripts being read by the public - there's a .htaccess password protection on the whole webserver directory, and the scripts aren't at all secret.
I thought of two possible solutions. The second best would be some kind of folder action or something which meant that every time a file named *.php was added to the webserver directory, a symbolic link to the file, named *.phps, was added to the same directory. This method would have to cope with file renaming, moved files and deleted files too - can't really see it working.
The better solution would be some Apache config trickery. I don't know if this is possible, but it would be great.
Would there be a way for Apache to accept an incoming request for *.phps (a file which doesn't exist), find instead the equivalent *.php (i.e. as per the standard Apache alias directive), but hand it to the x-httpd-php-source application rather than the usual x-httpd-php. This would be perfect for me, as it doesn't require any extra files, and the files and filenames would always be up-to-date. I read bits of the Apache manual yesterday, but couldn't quite see if this would be possible. I have CGI PHP too - maybe I could use that somehow?
Please DON'T worry about security for this - I'll sort that out when I have a solution!
I'm working on a complicated set of PHP scripts on my home machine at the moment. When at a friends house demonstrating one of them, I wanted to show him the source of a script. Sure, I could have SSH'ed in, but I couldn't be bothered - I needed a quick demo.
I thought it would be really nice to have a *.phps version of every *.php file I have in my webserver. I am not bothered about secret scripts being read by the public - there's a .htaccess password protection on the whole webserver directory, and the scripts aren't at all secret.
I thought of two possible solutions. The second best would be some kind of folder action or something which meant that every time a file named *.php was added to the webserver directory, a symbolic link to the file, named *.phps, was added to the same directory. This method would have to cope with file renaming, moved files and deleted files too - can't really see it working.
The better solution would be some Apache config trickery. I don't know if this is possible, but it would be great.
Would there be a way for Apache to accept an incoming request for *.phps (a file which doesn't exist), find instead the equivalent *.php (i.e. as per the standard Apache alias directive), but hand it to the x-httpd-php-source application rather than the usual x-httpd-php. This would be perfect for me, as it doesn't require any extra files, and the files and filenames would always be up-to-date. I read bits of the Apache manual yesterday, but couldn't quite see if this would be possible. I have CGI PHP too - maybe I could use that somehow?
Please DON'T worry about security for this - I'll sort that out when I have a solution!