Apache2, PHP, and the W3C xhtml validator 
July 17th, 2005, 02:09 AM
| | | |
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) == | 
July 17th, 2005, 02:10 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
Antho <prevent-shun@coz.spam.sux> writes:
[color=blue]
> 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?[/color]
Apparently the page is being delivered to the validator -- it's
just being delivered with a Content-Type that the validator doesn't
like.
[color=blue]
> 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.[/color]
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/ | 
July 17th, 2005, 02:10 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
Posted by Michael Fuhr on Sun, 16 Nov 2003 18:15:57 -0700:
<smipped stuff>[color=blue]
> Apparently the page is being delivered to the validator -- it's
> just being delivered with a Content-Type that the validator doesn't
> like.[/color]
Hmmm ... thanks! That makes sense, I think.
[color=blue]
> What's default_mimetype set to in php.ini? Have you set it to
> application/octet-stream anywhere?[/color]
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) == | 
July 17th, 2005, 02:10 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
Antho <prevent-shun@coz.spam.sux> writes:
[color=blue]
> Posted by Michael Fuhr on Sun, 16 Nov 2003 18:15:57 -0700:
>[color=green]
> > What's default_mimetype set to in php.ini? Have you set it to
> > application/octet-stream anywhere?[/color]
>
> 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"[/color]
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/ | 
July 17th, 2005, 02:11 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
Posted by Michael Fuhr on Sun, 16 Nov 2003 21:35:24 -0700:
[color=blue]
> 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.[/color]
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) == | 
July 17th, 2005, 02:12 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
Antho wrote:
[color=blue]
> The only thing is, when I upload the info.php file to the W3C validator,
> it complains:[/color]
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?
[color=blue]
> **Sorry, I am unable to validate this document because its content type is
> application/octet-stream, which is not currently supported by this service.**[/color]
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 | 
July 17th, 2005, 02:12 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
Antho <prevent-shun@coz.spam.sux> writes:
[color=blue]
> Posted by Michael Fuhr on Sun, 16 Nov 2003 21:35:24 -0700:
>[color=green]
> > 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.[/color]
>
> Yes, phpinfo() shows it is using /etc/php.ini.[/color]
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/ | 
July 17th, 2005, 02:12 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
John Dunlop <john+usenet@johndunlop.info> writes:
[color=blue]
> 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.[/color]
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/ | 
July 17th, 2005, 02:12 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
Posted by John Dunlop on Tue, 18 Nov 2003 16:35:05 +0000:
[color=blue]
> 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?[/color]
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) == | 
July 17th, 2005, 02:12 AM
| | | | re: Apache2, PHP, and the W3C xhtml validator
Posted by Michael Fuhr on Tue, 18 Nov 2003 11:05:50 -0700:
[color=blue]
> 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.[/color]
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) == |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,702 network members.
|