I created an html page with a simple php script like with an echo statement. When I run it on the WAMP server , it shows up as the actual code instead of executing the code.
I went to the www folder withing the WAMP installation and clicked on testmysql.php that does not seem to work either.
It seems I have not set it up correctly , could you please help ?
When I run this from a file named testing.php the browser shows as givwn below.
< ?php phpinfo(); ? >
Also the testingmysql.php file which comes with the stndard insallation of the WAMP gives the following message
Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\wamp\www\ estmysql.php on line 2
the code inside that is
<?php
$link = mysql_connect(‘hostname’,‘dbuser’,‘dbpassword’);
if (!$link) {
die('Could not connect to MySQL: ’ . mysql_error());
}
echo ‘Connection OK’; mysql_close($link);
?>
I am able to get a display of any simple html file that I create.
The tags to denote the start and end of a block of php in a php file are <?php and ?> you need to remove the spaces in the middle of the tags.
You need to swap “hostname”, “dbuser” and “dbpassword” for their appropriate values. The value for “hostname” will very likely be localhost. For dbuser and dbpassword it’s been a while since I installed wamp so I can’t remember what the default values (for them in wamp) are.