By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 2,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

Apache2, PHP, and the W3C xhtml validator

P: n/a
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 info.php is displayed as it should be.

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.**

My understanding in this instance, that the page should
be processed and delivered to the validator. This isnt happening. Does
anyone have an idea why it is failing in this manner?

At this stage, I am confused as to whether its a setting in PHP or Apache
that needs adjusting. As info.php works through my web-browser, I dont
understand why the page isnt being validated.

Any advice would be thankfully received!

--
== 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
Share this Question
Share on Google+
9 Replies


P: n/a
Antho <pr**********@coz.spam.sux> writes:
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 info.php is displayed as it should be.

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.**

My understanding in this instance, that the page should
be processed and delivered to the validator. This isnt happening. Does
anyone have an idea why it is failing in this manner?
Apparently the page is being delivered to the validator -- it's
just being delivered with a Content-Type that the validator doesn't
like.
At this stage, I am confused as to whether its a setting in PHP or Apache
that needs adjusting. As info.php works through my web-browser, I dont
understand why the page isnt being validated.


What's default_mimetype set to in php.ini? Have you set it to
application/octet-stream anywhere?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #2

P: n/a
Posted by Michael Fuhr on Sun, 16 Nov 2003 18:15:57 -0700:

<smipped stuff>
Apparently the page is being delivered to the validator -- it's
just being delivered with a Content-Type that the validator doesn't
like.
Hmmm ... thanks! That makes sense, I think.
What's default_mimetype set to in php.ini? Have you set it to
application/octet-stream anywhere?


Not that I am aware. As far as I know it is a standard install.

This is what /etc/php.ini has:

; As of 4.0b4, PHP always outputs a character encoding by default in
; the Content-type: header. To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
default_mimetype = "text/html"
;default_charset = "iso-8859-1"

--
== 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

P: n/a
Antho <pr**********@coz.spam.sux> writes:
Posted by Michael Fuhr on Sun, 16 Nov 2003 18:15:57 -0700:
What's default_mimetype set to in php.ini? Have you set it to
application/octet-stream anywhere?


Not that I am aware. As far as I know it is a standard install.

This is what /etc/php.ini has:

; As of 4.0b4, PHP always outputs a character encoding by default in
; the Content-type: header. To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
default_mimetype = "text/html"
;default_charset = "iso-8859-1"


Is your PHP installation using /etc/php.ini? Some installations
look for php.ini elsewhere, such as in /usr/local/lib. A phpinfo()
page will show you which php.ini file PHP is using, and it'll show
you the configuration settings.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #4

P: n/a
Posted by Michael Fuhr on Sun, 16 Nov 2003 21:35:24 -0700:
Is your PHP installation using /etc/php.ini? Some installations
look for php.ini elsewhere, such as in /usr/local/lib. A phpinfo()
page will show you which php.ini file PHP is using, and it'll show
you the configuration settings.


Yes, phpinfo() shows it is using /etc/php.ini.

--
== 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 #5

P: n/a
Antho wrote:
The only thing is, when I upload the info.php file to the W3C validator,
it complains:
I'm guessing you're using the validator's upload facility to upload
your file for validation. I'm not aware of any case where I'd wish to
validate a PHP file against an *ML DTD. Why do you wish to do so?
**Sorry, I am unable to validate this document because its content type is
application/octet-stream, which is not currently supported by this service.**


When you're uploading a file, your browser should send along a
Content-Type header; in the absence of that header, text/plain is
assumed. Your browser's evidently sending your file with a Content-
Type of application/octet-stream, which, as the error message says,
isn't supported by the W3C's validator.

If you're hellbent on validating PHP files by uploading them from
your system, try the WDG's HTML validator instead, or figure out how
to get your browser to send a Content-Type of text/html.

--
Jock
Jul 17 '05 #6

P: n/a
Antho <pr**********@coz.spam.sux> writes:
Posted by Michael Fuhr on Sun, 16 Nov 2003 21:35:24 -0700:
Is your PHP installation using /etc/php.ini? Some installations
look for php.ini elsewhere, such as in /usr/local/lib. A phpinfo()
page will show you which php.ini file PHP is using, and it'll show
you the configuration settings.


Yes, phpinfo() shows it is using /etc/php.ini.


I overlooked something that John Dunlop commented on in another
followup: you said that you were *uploading* the file to the W3C
Validation Service. I assumed (Bad Mike! Bad Mike!) that you were
using the "Validate URI" button to have the validator check the
output of a PHP page rather than using the "Validate File" button
to check the page containing the PHP source. Sorry about not asking
for clarification on that point.

If you want to validate the output of a PHP page (i.e., not the PHP
source but rather the output it produces) but you don't have a web
server that the W3C validator could reach, then load the page in
your browser (or use a tool like wget) and save it as a .html file,
then upload that file to the validator.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #7

P: n/a
John Dunlop <jo*********@johndunlop.info> writes:
If you're hellbent on validating PHP files by uploading them from
your system, try the WDG's HTML validator instead, or figure out how
to get your browser to send a Content-Type of text/html.


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.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #8

P: n/a
Posted by John Dunlop on Tue, 18 Nov 2003 16:35:05 +0000:
I'm guessing you're using the validator's upload facility to upload
your file for validation. I'm not aware of any case where I'd wish to
validate a PHP file against an *ML DTD. Why do you wish to do so?


Sorry John, I was unclear. I wanted to validate the output of the php
file, not the php itself.

I have gotten a solution to this problem and I am going to post it to the
NG's that I asked for help on.

Thanks for replying ...

--
== 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 #9

P: n/a
Posted by Michael Fuhr on Tue, 18 Nov 2003 11:05:50 -0700:
If you want to validate the output of a PHP page (i.e., not the PHP
source but rather the output it produces) but you don't have a web
server that the W3C validator could reach, then load the page in
your browser (or use a tool like wget) and save it as a .html file,
then upload that file to the validator.


Michael, you actually supplied the solution in an
earlier posting to my question.

Adding php to the appropriate line in my /etc/mime.types file worked. I
can see the page on my browser, plus, the W3C validator now accepts the
file type as well.

I am going to put it up on the NG's I asked on. It was so simple. I am
surprised that my searching didnt turn it up. I spent about 4 hours
yesterday wracking my brains about it.

Anyway, I am a happy chappy now ... thanks for your help on this.

--
== 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 #10

This discussion thread is closed

Replies have been disabled for this discussion.