user

Rakshit

1 Mar 2022

How the image file have .php extension?

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, 

//www.php.net/images/logo.php

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?

 

Ref: PHP

 

Comments

Shilpa

1 Mar 2022

Best Answer

best answer
github

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.

Replies

Mohamed Atef

1 Mar 2022

githubgithubgithub

Great job

© 2024 Copyrights reserved for web-brackets.com