I am trying to execute a PHP file and I need to know how its MIME Content-type
is so that it can be executed correctly in a browser.
What is the MIME Content-type
that should be used for .php
files?
Greetings and thanks
I am trying to execute a PHP file and I need to know how its MIME Content-type
is so that it can be executed correctly in a browser.
What is the MIME Content-type
that should be used for .php
files?
Greetings and thanks
The MIME Content-type
for files PHP
can be one of the following depending on the context:
text/plain
text/x-php
application/x-php
application/x-httpd-php
application/x-httpd-php-source
There is no official MIME type registered in IANA for PHP. IANA List .
PHP
provides the function mime_content_type () to detect the MIME Content-type
from a file:
$filename = "./info.php";
echo mime_content_type($filename);
// resultado: text/x-php
From the command line of Ubuntu
we can also see it
file -i nombre_archivo.php
//Resultado: nombre_archivo.php: text/x-php; charset=us-ascii