Jump to content


Photo

PHP script on running from an HTML file

php html

  • Please log in to reply
2 replies to this topic

#1 Computer42

Computer42

    Newbie

  • Member
  • Pip
  • 1 posts
  • Main OS: Windows 8

Posted 11 June 2017 - 04:00 PM

Hi,

 

I am running Uniform Server ZeroXIII - 13.3.2 portable under Windows 10 64bit.

 

I am unable to get a php script or file to run from within an HTML file. See HTLM file,

<html>

<body>

<p>First try with php:</p>

<?php

echo "My first PHP script!";

?>

</body>

</html>

 

When the file is run I get ‘First try with php’  come up but no "My first PHP script!" and no error message.

 

Various web sites talk about creating a file called .htaccess with the following line,

‘AddType application/x-httpd-php .html .htm’ and putting in the website root directory.

 

Can someone advise if this is correct and where the file should be placed as I have tried various placed without any success.

 

Regards

Peter



#2 Zerolinks

Zerolinks

    Newbie

  • Member
  • Pip
  • 4 posts
  • Main OS: Windows 8

Posted 05 July 2017 - 11:17 AM

It works fine with:

 

.htaccess

AddType application/x-httpd-php .html .htm

test.html (.html or .htm)

<html>
<body>
<p>First try with php:</p>

<?php
echo "My first PHP script!";
echo '<h1>'.time().'</h1>';
?>

</body>
</html>


#3 jessicabarnes

jessicabarnes

    Newbie

  • Member
  • Pip
  • 1 posts
  • Main OS: Windows 7

Posted Yesterday, 08:27 AM

Hello, When I was learning simple PHP programs, I've faced this kind of similar errors and problems. But nowadays, I am learning Laravel frameworks and starts to develop a basic simple web app.

Thanx







Also tagged with one or more of these keywords: php, html

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users