1 Mar 2022
PHP & Mysql
As a newbie PHP developer, I was looking the website php.net, with curiosity I was looking at the website thoughroly.
I saw one good-looking php logo and I inspected it with the google chrome developer console. That image address is like,
How is it possible to have a .php extension for the image file?
I see .jpg, .jpeg, .svg, .png etc… but .php is new for me!
I want to know how .php extension image works? what document type does it contain?
Yes, Everything is possible in the IT industry. Php allows any extension that doesn't really mean anything. You can keep .cartoon or no extension at all in any file.
As mentioned in the link, I observed a few things.
When .php is an image, it means the mime type depends on content-type, here it says image/png.
If you want to add the same, you can do it easily, for example - You are using apache httpd web server. Just update below line in your ‘httpd.conf’ or ‘.htaccess’ file under mime_module section.
AddType image/png .php
Hope this will clear your doubts.
You can read more here.
Link1: PHP Custom extension
Thanks for sharing the good observation, I never observed it.