472,975 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,975 software developers and data experts.

** SOLUTION: Apache2, PHP, and the W3C xhtml validator **

Firstly, thank you to everyone that replied to my OP. I am new to the PHP
world and so its great that there are people out there who are prepared to
share their knowledge.

Anyway, I am developing a website on my home pc. I dont have server-space
outside my home. So, I needed to be able to validate my code by file
upload to the W3C's html validator at http://validator.w3.org/

This solution is so easy, I am surprised that my extensive googling didnt
provide an answer as it does return MANY hits relating to this search. I
thought I would post this so that there is something **out there** for
others that come across this problem.

My original problem was ...

I have installed Apache2 and PHP on my Mdk 9.2 box. I have made an
info.php page to test if php is working. It appears that it is as my
info.php is displayed as it should be on my web-browser.

The only thing is, when I upload the info.php file to the W3C validator,
it complains:

**Sorry, I am unable to validate this document because its content type
is application/octet-stream, which is not currently supported by this
service.**


The solution is very easy. Thank you to Michael Fuhr for the tip!
Some browsers on some systems use the file ~/.mime.types,
/etc/mime.types, or another such file to determine an uploaded file's
Content-Type. Creating or editing one of those files and adding a line
such as "text/html php" should do the trick, although I don't know what
other implications that might have.


On Mandrake Linux 9.2, in the file /etc/mime.types change this line:

text/html html htm

to

text/html html htm php

The W3C validator will then start accepting the output of php files.

Yippee!! No more ** content type is application/octet-stream ** problem!

Thanks once again for helping me out!!!

--
== cBe! ==== @ntho === 8 ^ ) ========================================
== Famous last words from Registered Linux User #296186 =============
== "I would have made a good Pope." - Richard M. Nixon (1913-1994) ==

Jul 17 '05 #1
4 2859
Antho <pr**********@coz.spam.sux> writes:
I have installed Apache2 and PHP on my Mdk 9.2 box. I have made an
info.php page to test if php is working. It appears that it is as my
info.php is displayed as it should be on my web-browser.

The only thing is, when I upload the info.php file to the W3C validator,
it complains:

**Sorry, I am unable to validate this document because its content type
is application/octet-stream, which is not currently supported by this
service.**


The solution is very easy. Thank you to Michael Fuhr for the tip!


John Dunlop really deserves the thanks -- he noticed that you were
uploading a file for validation, while I initially assumed (incorrectly)
that you were submitting a URI.
Some browsers on some systems use the file ~/.mime.types,
/etc/mime.types, or another such file to determine an uploaded file's
Content-Type. Creating or editing one of those files and adding a line
such as "text/html php" should do the trick, although I don't know what
other implications that might have.


On Mandrake Linux 9.2, in the file /etc/mime.types change this line:

text/html html htm

to

text/html html htm php

The W3C validator will then start accepting the output of php files.


Not so fast. Your browser is probably uploading the source PHP
file, not the output. Try again at the Extended File Upload
Interface:

http://validator.w3.org/file-upload.html

Turn on "Show Source" and then upload one of your PHP files. When
you get the validation result, scroll down to "Source Listing" and
you should see your PHP code, not the output of that code. If you
want to validate the output, which is what you should be validating,
then you'll have to make sure the PHP code is actually run, either
by the web server or via the command-line interface. You'll have
to save the output somewhere and upload *that* file, not the .php
file that generated the output.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #2
Posted by Michael Fuhr on Tue, 18 Nov 2003 20:44:36 -0700:
Antho <pr**********@coz.spam.sux> writes:
<snipped stuff>
The solution is very easy. Thank you to Michael Fuhr for the tip!


John Dunlop really deserves the thanks -- he noticed that you were
uploading a file for validation, while I initially assumed (incorrectly)
that you were submitting a URI.

<snipped stuff>
Not so fast. Your browser is probably uploading the source PHP
file, not the output. Try again at the Extended File Upload
Interface:

http://validator.w3.org/file-upload.html

Turn on "Show Source" and then upload one of your PHP files. When
you get the validation result, scroll down to "Source Listing" and
you should see your PHP code, not the output of that code. If you
want to validate the output, which is what you should be validating,
then you'll have to make sure the PHP code is actually run, either
by the web server or via the command-line interface. You'll have
to save the output somewhere and upload *that* file, not the .php
file that generated the output.


ok. You are right, of course! My php code does appear. Are
you saying that I could **never** validate a file directly from my
hard-drive? I have to load the page in the browser, copy page source, save
file as html, then upload **that** file to the validator.

I guess its because it is coming from the folder /var/www/etc/etc, and
therefore isnt really being "served".

--
== cBe! ==== @ntho === 8 ^ ) ========================================
== Famous last words from Registered Linux User #296186 =============
== "I would have made a good Pope." - Richard M. Nixon (1913-1994) ==

Jul 17 '05 #3
Antho <pr**********@coz.spam.sux> writes:
Posted by Michael Fuhr on Tue, 18 Nov 2003 20:44:36 -0700:
Turn on "Show Source" and then upload one of your PHP files. When
you get the validation result, scroll down to "Source Listing" and
you should see your PHP code, not the output of that code. If you
want to validate the output, which is what you should be validating,
then you'll have to make sure the PHP code is actually run, either
by the web server or via the command-line interface. You'll have
to save the output somewhere and upload *that* file, not the .php
file that generated the output.


ok. You are right, of course! My php code does appear. Are
you saying that I could **never** validate a file directly from my
hard-drive? I have to load the page in the browser, copy page source, save
file as html, then upload **that** file to the validator.

I guess its because it is coming from the folder /var/www/etc/etc, and
therefore isnt really being "served".


Right -- something has to run the PHP code so you can get the output,
and your browser doesn't do that. If the page doesn't depend on
being run in a web server context, then you could get to a shell
prompt and run "php foo.php > foo.html" and then upload foo.html
to the validator. But if the page depends on form data or other
information from the web server, then you'll have to use your browser
or a utility such as wget or curl to issue an HTTP request for the
page and then save the output.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #4
In article <pa****************************@coz.spam.sux>,
Antho <pr**********@coz.spam.sux> wrote:

:My original problem was ...
:
:
:> I have installed Apache2 and PHP on my Mdk 9.2 box. I have made an
:> info.php page to test if php is working. It appears that it is as my
:> info.php is displayed as it should be on my web-browser.
:>

Interesting. I didn't see your original post, but I had exactly the same
error on a Mac. I tried to upload "index.php" to The Validator and I got
the same error message. In my case, I reckon it was Mozilla who thought
that the .php extension meant she was uploading a binary file. I changed
it to "index.html" and the problem was fixed; I probably could have used
"index.txt" too. I haven't done this, because I rarely validate that
way, but you can tell Mozilla that .php is a plain-text file somewhere
in her settings.

I don't know why I think Mozilla is a girl.
--
Looks like more of Texas to me.
.... Arizona, where the nights are warm and the roads are straight.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Antho | last post by:
Hello NG Sorry if this is the wrong NG to post this in. I have installed Apache2 and PHP on my Mdk 9.2 box. I have made an info.php page to test if php is working. It appears that it is as my...
6
by: Jonny | last post by:
How can you validate Javascript generated HTML for XHTML 1.0 strict compliance? To avoid the "<" and "&" problem, all inline scripts MUST be enclosed with either: <!-- script --> Looked down...
13
by: Ben Sharvy | last post by:
Is there a list of the changes you need to make to HTML 4.1 cose to make it dual compliant, with XHTML 1.1 also?
59
by: Philipp Lenssen | last post by:
I've tested some of the new Nokia 6600 functionality. It ships with WAP2 and XHTML Support (it says). What it does is check the Doctype -- if it's not the XHTML Mobile Profile Doctype, but a...
3
by: Ney André de Mello Zunino | last post by:
Hello. I decided to start experimenting with XHTML 2.0, having never messed with any of its previous versions, except for a quick look at XHTML 1.0 when it came out. When I tried to validate the...
37
by: Roedy Green | last post by:
does converting the XHTML make matters better or worse vis a vis CSS not behaving the way you expect? -- Bush crime family lost/embezzled $3 trillion from Pentagon. Complicit Bush-friendly...
9
by: rbronson1976 | last post by:
Hello all, I have a very strange situation -- I have a page that validates (using http://validator.w3.org/) as "XHTML 1.0 Strict" just fine. This page uses this DOCTYPE: <!DOCTYPE html PUBLIC...
11
by: Tomek Toczyski | last post by:
What is the best way to attach a caption to an image in xhtml? I can attach a caption to a table by a "<caption>" tag but I would like to do sth similar to an image. How to do it in a natural...
11
by: Michael Powe | last post by:
How can I make an XHTML-compliant form of an expression in this format: document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>"); this turns out to be a...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.