I am wriritng HTTP server with python socket. I have a web page that contain PHP code like this
<!DOCTYPE html>
<html>
<body>
<?php
echo "My first PHP script!";
?>
</body>
</html>
which a want to send to client, when i send it normally the PHP file will not be compiled and only send like a string and nothing happen in browser. if i want to cmpile and send php code what should i do? i send file like this:
with open(filename[1:]) as f:
outputdata = f.read()
self.request.send(bytes('
HTTP/1.1 200 OK
','utf-8'))
for i in range(0, len(outputdata)):
self.request.send(bytes(outputdata[i],'utf-8'))
self.request.close()