user image

Rakshit
Published in : 2022-03-01

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, 

https://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?

 

Comments

Shilpa Date : 2022-03-01

Best answers

10

Best answers

10

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.

Mohamed Atef Date : 2022-03-01

Great job

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

mysql service start not exist
Publish date: 2022-02-23 | Comments: 4

Tag: PHP & Mysql

ERROR 1410 (42000): You are not allowed to create a user with GRANT
Publish date: 2022-04-01 | Comments: 2

Tag: PHP & Mysql

php difference between two times in hours
Publish date: 2022-02-25 | Comments: 2

Tag: PHP & Mysql

[solved] #1273 - Unknown collation: 'utf8mb4_0900_ai_ci'
Publish date: 2022-01-09 | Comments: 1

Tag: PHP & Mysql

[solved] Storage engine 'InnoDB' does not support system tables
Publish date: 2022-01-09 | Comments: 0

Tag: PHP & Mysql

MySQL - Lost connection to MySQL server during query - Required a solution.
Publish date: 2022-03-03 | Comments: 1

Tag: PHP & Mysql

change user root privelige and password
Publish date: 2022-02-23 | Comments: 1

Tag: PHP & Mysql

CodeIgniter route does not work
Publish date: 2022-02-22 | Comments: 4

Tag: PHP & Mysql