473,503 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

** 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 2886
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
5098
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
2155
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
2907
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
4685
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
4086
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
2692
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
2327
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
4182
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
3079
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
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7089
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.