Reputation: 320
I create a new HTML file for my project using Dreamweaver and i added a simple php code:
<!DOCTYPE html>
<html>
<body>
<?php
echo "My first PHP script!";
?>
</body>
</html>
so far nothing is appearing while i open the file with google chrome and IE, any thoughts?
Upvotes: 1
Views: 1975
Reputation: 10675
PHP has to be executed on the server. Upload it to a web server that supports PHP, or install your own web server locally such as WAMP. You then need to access the file with a URL rather than just opening it. A local URL will look like http://localhost/
or http://127.0.0.1/
.
Your file also needs to have the extension .php
if it contains PHP code. If you really want to use PHP inside a .html
file, your web server will need to be set up specially to handle this.
Upvotes: 4
Reputation: 5199
A good idea to check if your php file is working properly is to load phpinfo function. This function will show details about your PHP installation:
<?php
phpinfo();
?>
If what you see on the screen is this php code with the entire opening and closing tags (), then you are not running the page with PHP.
Upvotes: 0