| | |
My embedded php code won't execute
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
This works:
-----------PrintInfo.php
<?php
phpinfo();
?>
--------------------------
But this doesn't:
-------------PrintInfo.html
<html>
<head>
<title> Hello World </title>
</head>
<body>
<?php
echo 'This is my first PHP web page.';
?>
</body>
</html>
-------------------------
I'm using Apache 2.0 on WinXP Home with php 5.
Thanks!
-----------PrintInfo.php
<?php
phpinfo();
?>
--------------------------
But this doesn't:
-------------PrintInfo.html
<html>
<head>
<title> Hello World </title>
</head>
<body>
<?php
echo 'This is my first PHP web page.';
?>
</body>
</html>
-------------------------
I'm using Apache 2.0 on WinXP Home with php 5.
Thanks!
•
•
Join Date: Feb 2003
Posts: 282
Reputation:
Solved Threads: 6
It has to end in .php to be parsed by the PHP engine, change your file name back to PrintInfo.php.
The HTML code (within the PrintInfo.php code) will not be analysed by the PHP parser, bnut instead be sent straight to output. The PHP parser only reads between the <?php and ?> tags.
The HTML code (within the PrintInfo.php code) will not be analysed by the PHP parser, bnut instead be sent straight to output. The PHP parser only reads between the <?php and ?> tags.
•
•
•
•
Originally Posted by Roberdin
It has to end in .php to be parsed by the PHP engine, change your file name back to PrintInfo.php.
The HTML code (within the PrintInfo.php code) will not be analysed by the PHP parser, bnut instead be sent straight to output. The PHP parser only reads between the <?php and ?> tags.
AddType application/x-httpd-php .html
to get apache to associate .html files with the php engine.
![]() |
Similar Threads
- help executing a .wav file with php code (PHP)
- Secure php code (PHP)
- Exicution of PHP code at spacific time without any action/event (PHP)
- How do I write php code to check if checkbox is checked or not (PHP)
- PHP code not blending with HTML (PHP)
Other Threads in the PHP Forum
- Previous Thread: phpBB 2.1.2 Demo Board
- Next Thread: PHP vs. Pearl
| Thread Tools | Search this Thread |
301 access apache api array autocomplete beginner binary broken button cakephp checkbox class cms code compression cron curl data database date display dropdown dropdownlist duplicates dynamic echo email error execution file files folder form forms function functions google href htaccess html htmlspecialchars httppost image include insert integration ip javascript joomla jquery limit link links login mail md5 menu methods mlm multiple mysql oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote script search secure server session sessions sms source space sql subscription syntax system table tutorial update upload url validator variable video virus volume votedown web youtube





