[PHP] File extension for PHP's serialization format?

2006-10-26 Thread Hamish Lawson
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



Re: [PHP] File extension for PHP's serialization format?

2006-10-26 Thread Hamish Lawson

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?

2006-10-27 Thread Hamish Lawson

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?

2006-10-27 Thread Hamish Lawson

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