Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP script on running from an HTML file

Featured Replies

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

  • 4 weeks later...

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>
  • 1 month later...

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

  • 2 years later...

The standard way would be to use a .php extension for a file containing PHP code. That way if another developer takes up your work, the standards would help that new programmer easily take over.

Yes adding in the handler to the .html file in .htaccess would work, but would not be a standard way of doing things.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.