Page 1 of 1

XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 15. April 2011 13:20
by DRSK
PHP, HTML5 and Apache - Not working together
I've tried the following:
  • Reinstallation
  • Upgrade from 1.7.3 > 1.7.4
  • Clean install of 1.7.4 (CCleaner and complete uninstallation pre to clean install)
None of above fixes the issue where HTML5-elements are ignored and not being rendered whereas HTML4.x-elements are intact and being rendered successfully.
Take a look at my index.php test file below:
Code: Select all
<!DOCTYPE html>
<html>
<head>
   <title></title>
</head>

<body>

<header>
    <h1><a href="index.php">Logo</a></h1>

   <nav>
      <ul>
         <li class="active"><a href="#">Link</a></li>
         <li><a href="#">Link</a></li>
      </ul>
   </nav><!-- end: nav -->
</header><!-- end: #banner -->


<p>Test HTML4.x-element</p>

</body>
</html>


Basically, only the paragraph (<p>) element is displayed, although viewing source gives you the HTML5-elements as well. They aren't getting rendered.
I've remapped the ROOT to be X:\Web and Xampp is installed at X:\xampp. <?php echo 'Hello'; ?> works, anywhere, e.g. X:\Web\index.php.
So this is CLEARLY an issue with HTML5, Apache and PHP not working with Xampp. At all.

What do I need to do?

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 15. April 2011 13:31
by Sharley
To test your html5 I copied your code to a file and named it html5.html and then copied the file into the htdocs folder of XAMPP 1.7.4.
In the browser I typed http://localhost/html5.html and hey presto it looked exactly as it should, without any errors and the html5 was rendered as expected.

So your issue is not with Apache, html5 or php but rather with how you mapped the DocumentRoot of Apache.

Try it in a default 1.7.4 installation first, making sure your code works, then experiment with your 'root' mapping, what ever that means, then you will know if you get errors where to look.

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 15. April 2011 15:19
by DRSK
Sharley wrote:To test your html5 I copied your code to a file and named it html5.html and then copied the file into the htdocs folder of XAMPP 1.7.4.
In the browser I typed http://localhost/html5.html and hey presto it looked exactly as it should, without any errors and the html5 was rendered as expected.

So your issue is not with Apache, html5 or php but rather with how you mapped the DocumentRoot of Apache.

Try it in a default 1.7.4 installation first, making sure your code works, then experiment with your 'root' mapping, what ever that means, then you will know if you get errors where to look.


Does it render the HTML5 elements if you use .php instead of .html? Because that is the problem I'm having. Using PHP and HTML5.

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 15. April 2011 22:47
by DRSK
wole wrote:Only the doctype is html5, all the rest is ordinary standard html
And all modern browser know this doctype and read it as html.


I'm sorry, your post makes no sense. How is <header> and <nav> etc not HTML5? I think you've failed to realize there's a scroll function to the code box.

And again, it is a fresh install, only changes done to httpd.conf are DocumentRoot "X:/Web" (line 183) and <Directory "X:/Web"> (line 210). The problem persists, having X:\Web\testfile.php with the content from my code block above will only output the elements that aren't HTML5. So <header> and <nav> etc aren't displayed, but the <p> is.

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 16. April 2011 03:06
by Sharley
DRSK wrote:
wole wrote:Only the doctype is html5, all the rest is ordinary standard html
And all modern browser know this doctype and read it as html.

I'm sorry, your post makes no sense...
As is often the case with posts in the English forums by this non English speaking member. :)


DRSK wrote:And again, it is a fresh install, only changes done to httpd.conf are DocumentRoot "X:/Web" (line 183) and <Directory "X:/Web"> (line 210). The problem persists, having X:\Web\testfile.php with the content from my code block above will only output the elements that aren't HTML5. So <header> and <nav> etc aren't displayed, but the <p> is.

I edited my httpd.conf file and changed the lines above to:
Code: Select all
DocumentRoot "H:/Web"
<Directory "H:/Web">
after creating a new folder Web in my H drive (no X drive and I remembered that Apache is case sensitive).

I then added the php code to the html5 code like so
Code: Select all
</head>

<body>

<header>
    <h1><a href="index.php">Logo</a></h1>

   <nav>
      <ul>
         <li class="active"><a href="#">Link</a></li>
         <li><a href="#">Link</a></li>
      </ul>
   </nav><!-- end: nav -->
</header><!-- end: #banner -->


<p>Test HTML4.x-element</p>

<?php echo 'Hello'; ?>

</body>
</html>
Then renamed it to index.php and copied into H:\Web

I restarted the Apache server so it recognised the changes in the httpd.conf file and then when I went to
http://localhost/
in my browser and I see the correct result of the html5.

So the problem is not related to your changes to the conf file or how the index.php is being handled by the server and the browser but rather the issue is... well I can only guess as I can't reproduce your issue.

The above post is to show that your index.php file does work in a default 1.7.4 installation so you will have to investigate further this issue.

Are there any clues in the \xampp\apache\logs\error.log file or even the access.log file?

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 16. April 2011 11:43
by DRSK
Thanks to your help I've been able to find the bug/error with my code. As you said it had nothing to do with me changing the DocumentRoot or other settings. I've actually never ran into this "bug" before, so to be sure it has nothing to do with Xampp perhaps you can see if the bug also affects you?

Anyways, I discovered that the only HTML5-element in my testing that did not work was <header id="banner">. So, what happens if you try:
Code: Select all
<!DOCTYPE html>
<html>
<head>
   <title>Test Page</title>

</head>

<body>
<header id="banner">
   <h1>This is a header</h1>
   
   <nav>
      <ul>
         <li>List item</li>
         <li>List item 2</li>
      </ul>
   </nav>
</header><!-- No content within <header> is shown -->

<p>
   This is a paragraph
</p>

<?php echo 'PHP echo'; ?>

</body>
</html>


For some reason, having id="banner" within <header> disables the entire element and therefore it is unable to render. Although the element does show up in "view source". This may be something with HTML5 or Xampp, I have no idea. Really bugged me though, since viewing the file with Google Chrome locally; file:///X:/Web/index.php <header> works perfectly, only thing not working is the <?php ?> of course. But serving the page through Xampp disables the <header> but then again the <?php ?> -tag works. I'm struck, I have no clue what is going on.

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 16. April 2011 11:57
by Altrea
DRSK wrote:So this is CLEARLY an issue with HTML5, Apache and PHP not working with Xampp. At all.

Neither Apache nor the php interpreter do anything with your HTML exept to send it as plain text to your Browser.
So this can only be a Browser issue, or a path issue (path to external files like css files).

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 16. April 2011 12:06
by Sharley
The code you pasted, as expected, works fine and no bugs.

You must look elsewhere for your problem now that the code you pasted twice is not bugged or giving errors on a default installation of XAMPP 1.7.4 and as I pointed out above, the log files are a good place to starts.

Good luck and best wishes.

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 16. April 2011 12:29
by DRSK
Sharley wrote:The code you pasted, as expected, works fine and no bugs. ...



I've looked at the log files and they aren't saying anything remotely related to the issue I'm experiencing. Weird you're not getting the same error, so I figured it must be the browser.
Take a looksie at http://drsk.se/test/ with Google Chrome and inspect that page, also view source to see differences. I viewed the page with iPhone and there are no bugs, so perhaps id="banner" is somehow reserved for Chrome for some reason. Sorry for the inconvenience!

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 16. April 2011 12:31
by Altrea
Your site looks like it should.
Everything inside the header Tags is shown.

Tested with Chrome 10.0.648.204

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 16. April 2011 12:33
by DRSK
Altrea wrote:Your site looks like it should.
Everything inside the header Tags is shown.

Tested with Chrome 10.0.648.204



Thanks, seems to be something with my Chrome. I'll have to investigate some more! Thank you for clearing things out.

//DRSK

Re: XAMPP 1.7.4 - PHP, HTML5 and Apache won't comply

PostPosted: 16. April 2011 12:45
by Sharley
I see no problems as it looks the same as I have already posted.

So it looks like a browser issue so check your browser's settings or...
DRSK wrote:so perhaps id="banner" is somehow reserved for Chrome for some reason.
...'banner' may be being blocked by the likes of adblock or which ever ad blocker you use.