Reputation: 13
I'm trying to generate a webpage with cgi that contains both html and php.
When I directly type some basic code in a file "test.php", it works fine:
<html>
<body>
<h1> Hello world! </h1>
<?php phpinfo() ?>
</body>
</html>
When I generate only html code with an executable file "test.cgi" (located in cgi-bin), it also works fine:
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<body>"
echo "<h1> Hello world! </h1>"
echo "<html>"
echo "<body>"
But when I try to add a line of php, it doesn't work anymore:
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<body>"
echo "<h1> Hello world! </h1>"
echo "<?php phpinfo() ?>"
echo "<html>"
echo "<body>"
Only the html part is displayed. Any php seems to be neglected.
Some more information:
- Ubuntu 12.04
- PHP Version 5.3.10-1ubuntu3.4
- Apache2
Can somebody help me on this?
Upvotes: 1
Views: 91
Reputation: 2068
My understanding, and I hope somebody will correct me if I'm wrong, is that
but in each case, what it does is deliver HTML to the browser. CGI does not deliver its output back to the web server for re-processing as PHP code.
Upvotes: 1