Phar: Mapping HTTP URLs to a www/ subdirectory
| From: | Christian Weiske | Date: | Thu, 11 Aug 2011 18:22:40 +0000 |
| Subject: | Phar: Mapping HTTP URLs to a www/ subdirectory | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-314499@lists.php.net to get a copy of this message | ||
Hello,
I'm failing to create a .phar file for SemanticScuttle[1], a
self-hosted social bookmarking application.
The directory layout of SC is as follows:
- data/
- doc/
- scripts/
- src/
- SemanticScuttle/
- Service.php
- www/
- index.php
- edit.php
The separation of src/, data/ and www/ is to be sure only relevant
files are exposed to the web visitor, keeping files in data/, scripts/
and src/ only accessible via the file system, but not via the web
server.
I am trying to do the same with the .phar: Have all www/ files
accessible from outside while still having src/ and scripts/ in the
.phar for CLI access.
There seemed to be several possible solutions:
1. Modify $_SERVER['REQUEST_URI']
by adding /www/, so the normal phar web mapping code would take place.
This does not work - the phar C code uses the original SERVER
variables, not the ones from PHP:
> When executed by a web-based sapi, this reads
> $_SERVER['REQUEST_URI'] (the actual original value)
2. Use webPhar()'s mapping functionality.
This is very hard to achieve, because I have over 200 files that need
to be accessible, and I don't want to add all that mappings.
Is there a better solution to map all web/HTTP requests to the phar to
a subdirectory inside the phar?
--
Regards/Mit freundlichen Grüßen
Christian Weiske
-=≡ Geeking around in the name of science since 1982 ≡=-
Attachment: [application/pgp-signature] signature.asc
Attachment: [application/pgp-signature] signature.asc