PHP3
text/x-php
Magic Bytes
Offset: 0
3C 3F 70 68 70
PHP3 is a legacy file format used for scripts written in the third version of the PHP Hypertext Preprocessor, originally developed by the PHP Development Team. It was primarily employed for server-side web development to generate dynamic web content during the late 1990s. As an obsolete format, it is now rarely encountered, though the underlying text remains safe unless executed on a web server containing specific software vulnerabilities or outdated interpreters.
Validation Code
How to validate .php3 files in Python
Python
def is_php3(file_path: str) -> bool:
"""Check if file is a valid PHP3 by magic bytes."""
signature = bytes([0x3C, 0x3F, 0x70, 0x68, 0x70])
with open(file_path, "rb") as f:
return f.read(5) == signature
How to validate .php3 files in Node.js
Node.js
function isPHP3(buffer: Buffer): boolean {
const signature = Buffer.from([0x3C, 0x3F, 0x70, 0x68, 0x70]);
return buffer.subarray(0, 5).equals(signature);
}
Go
func IsPHP3(data []byte) bool {
signature := []byte{0x3C, 0x3F, 0x70, 0x68, 0x70}
if len(data) < 5 {
return false
}
return bytes.Equal(data[:5], signature)
}
API Endpoint
GET
/api/v1/php3
curl https://filesignature.org/api/v1/php3