February 22nd, 2004, 02:07 PM
unable to generate WML with PHP
I am trying to generate WML with PHP. i have added this line to my httpd.conf:
and am testing this simple script (test.wml):
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
<card id="card1" title="Example 1">
However i get this... 500: Web service problem: Please contact the service provider.
any ideas why this is not working?
thanks for any help
March 10th, 2004, 01:10 AM
No no no! Take out the AddType directive. Here is what is happening:
You have just set it up so that the server hands all .wml files over to the PHP module (take a look at: http://chiralsoftware.net/manual/man...ernalreference if you want to learn more than you wanted to know about this).
So, all .wml gets handed over to the PHP interpreter, which then sets the mime type to its default MIME type and then executes the script. Problem: PHP's default mime type is text/html. So, by putting in that AddType all of your .wml files are interpreted as PHP and all of them get the default PHP mime type. Neither of these are what you want most likely.
Now, you are probably about to say right now "but I put the Header command in which would set the content type correct even so." Maybe! Maybe maybe. The problem is that if there is any output before the header command, the header command has no effect (as far as I remember). This means that if there is a space or a return, that header command isn't doing anything.
So, take out the AddType, rename your file to a .php file, and make sure there are no spaces or output of any kind before the Header directive is reached. PHP may also have a set-content-type directive that you can use without having to manipulate the header directly.