php script - problems with characters
Posted by: monkeyprint (---.range86-184.btcentralplus.com)
Date: January 19, 2012 04:26PM

Hi I have just installed Wamp

I have been trying to start creating php scripts but for some reason the pages and displaying as the code is programmed.
i.e.

Simplistically: -

<?php $myString = "Hello!";
echo $myString;
echo "<h5>I love using Wamp</h5>";

when running displays as: -

I love using Wamp!";

Should be: -

Hello! I love using Wamp

Is this to do with the configeration?

Iain

Options: ReplyQuote
Re: php script - problems with characters
Posted by: stevenmartin99 (---.251.255.15.threembb.ie)
Date: January 19, 2012 04:30PM

No - if this is the exact code then that's a very strange issue indeed.

Can you please paste ur exact code directly into
 tags

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: php script - problems with characters
Posted by: monkeyprint (---.range86-184.btcentralplus.com)
Date: January 19, 2012 05:08PM

This is it: -

<?php $myString = "Hello!";
echo $myString;
echo "<h5>I love using PHP!</h5>";
?>

Options: ReplyQuote
Re: php script - problems with characters
Posted by: RiggsFolly (---.as13285.net)
Date: January 31, 2012 12:51PM

Reading between the lines, it sounds to me like Apache is not passing your script to php to parse your code and is just serving up the script raw.

There could be a couple of reasons for this:-

1. If you have coded your script in a file with a .html or .htm extension apache will not pass your code to php before serving it. ( with the default apache config that comes with WAMP )

Change the extension of your source file to have a .php extension.

2. If you want apache to send .html extension files to be parsed by php you will need to add a line like this to your http.conf file ( left click the wamp icon and click Apache->http.conf )

AddType application/x-httpd-php .html
Check to see where there are other statements like this in the conf file and add it there.


Option 1 is the best solution.


Hope this helps!

Options: ReplyQuote


Sorry, only registered users may post in this forum.