Re: [PHP] File extension for PHP's serialization format?
# [EMAIL PROTECTED] / 2006-10-27 02:06:22 +0100: Hello Chris Thanks for responding. But what file extension should I use for PHP's serialization format? Obviously it can't be .php - aside from being inaccurate (it's not PHP code), using this extension would probably trigger the web server into trying to run a (nonexistent) PHP script. You can rewrite the url using mod_rewrite or some such variant to handle this. Yes, there may well be ways to get round what the web server would otherwise do when it encounters a .php extension, but I feel that I'd be breaking an expectation. I'd much rather use an extension that was specific to the serialization format. Hamish, there's no standard filename extension for PHP-serialized data, I'd just use txt or something... .psdf or whatever. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
Hello Chris You could convert it to a php file: RewriteCond %{REQUEST_URI} *.json RewriteRule ^(.*).json$ json.php?$1 [T=application/x-httpd-php,L] Thanks for continuing to work on this, but I'm afraid my inadequate explanation has sent you in the wrong direction. Let's see if I can do better. Forget for the moment that the files are generated dynamically and instead suppose that they were static files. An example of a file containing JSON data would be engineering.json. But what about the equivalent information in PHP serialized format? Calling it engineering.php would be inappropriate for the reasons I gave before. Hamish -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
Hello Roman there's no standard filename extension for PHP-serialized data, I'd just use txt or something... .psdf or whatever. .ser is used for serialized Java objects and I've found .jser also being used (though less frequently) for that. On the analogy of the latter I'll plump for .pser. Hamish -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
Hamish Lawson wrote: I have a web application (not written in PHP) that can return data in various formats, including JSON and PHP's serialization format. At the moment my URL scheme looks like this: staff/engineering?format=json but I'd like to switch to using a file extension to denote the format: staff/engineering.json But what file extension should I use for PHP's serialization format? Obviously it can't be .php - aside from being inaccurate (it's not PHP code), using this extension would probably trigger the web server into trying to run a (nonexistent) PHP script. Given that file extensions are purely for association purposes and no application I am aware of knows what to do with PHP serialised data, personally I would use .dat. Or, if I wanted it to be more descriptive, something like .phpdata. But to be perfectly frank it doesn't matter. Small suggestion though... rather than falling back to the evils of mod_rewrite, enable multiviews and you can have URLs such as... staff/engineering/data.json Or whatever filename you want. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
On 27/10/06, Stut [EMAIL PROTECTED] wrote: Hamish Lawson wrote: I have a web application (not written in PHP) that can return data in various formats, including JSON and PHP's serialization format. At the moment my URL scheme looks like this: staff/engineering?format=json but I'd like to switch to using a file extension to denote the format: staff/engineering.json Given that file extensions are purely for association purposes and no application I am aware of knows what to do with PHP serialised data, personally I would use .dat. Or, if I wanted it to be more descriptive, something like .phpdata. But to be perfectly frank it doesn't matter. I know of one website (Livejournal) that has /url.../data/rss or /data/atom etc. /data/php, /data/wddx or /data/json are pretty obvious extensions to that. That said, since all are them are designed for a script to consume, and not a person, I'd call them entirely 'clean' and obvious enough for the task, though ultimately, it's about having a pretty URL, as the program that reads it won't care what the extension is, if any, and people won't be typing it in regularly anyway. Alister -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
.phps is taken for PHP Source, so using it for PHP Serialized would be Bad. Perhaps phpd for PHP Data would suit you. You could make it anything you want, as far as I know. Actually, you could make it be .php and use ForceType in .htaccess to do what you describe, but that's probably not a Good Idea for clarity sake. I take that back -- you wouldn't need the .htaccess and all that, as you are already doing that with the 'staff' file and 'engineering' is just part of your $_SYSTEM['PATH_INFO'] On Thu, October 26, 2006 11:30 am, Hamish Lawson wrote: I have a web application (not written in PHP) that can return data in various formats, including JSON and PHP's serialization format. At the moment my URL scheme looks like this: staff/engineering?format=json but I'd like to switch to using a file extension to denote the format: staff/engineering.json But what file extension should I use for PHP's serialization format? Obviously it can't be .php - aside from being inaccurate (it's not PHP code), using this extension would probably trigger the web server into trying to run a (nonexistent) PHP script. Thanks, Hamish Lawson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
Hamish Lawson wrote: I have a web application (not written in PHP) that can return data in various formats, including JSON and PHP's serialization format. At the moment my URL scheme looks like this: staff/engineering?format=json but I'd like to switch to using a file extension to denote the format: staff/engineering.json But what file extension should I use for PHP's serialization format? Obviously it can't be .php - aside from being inaccurate (it's not PHP code), using this extension would probably trigger the web server into trying to run a (nonexistent) PHP script. You can rewrite the url using mod_rewrite or some such variant to handle this. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
Hello Chris Thanks for responding. But what file extension should I use for PHP's serialization format? Obviously it can't be .php - aside from being inaccurate (it's not PHP code), using this extension would probably trigger the web server into trying to run a (nonexistent) PHP script. You can rewrite the url using mod_rewrite or some such variant to handle this. Yes, there may well be ways to get round what the web server would otherwise do when it encounters a .php extension, but I feel that I'd be breaking an expectation. I'd much rather use an extension that was specific to the serialization format. Hamish -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File extension for PHP's serialization format?
Hamish Lawson wrote: Hello Chris Thanks for responding. But what file extension should I use for PHP's serialization format? Obviously it can't be .php - aside from being inaccurate (it's not PHP code), using this extension would probably trigger the web server into trying to run a (nonexistent) PHP script. You can rewrite the url using mod_rewrite or some such variant to handle this. Yes, there may well be ways to get round what the web server would otherwise do when it encounters a .php extension, but I feel that I'd be breaking an expectation. I'd much rather use an extension that was specific to the serialization format. You could convert it to a php file: RewriteCond %{REQUEST_URI} *.json RewriteRule ^(.*).json$ json.php?$1 [T=application/x-httpd-php,L] Might not work straight away but that should give you an idea of what's possible. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php