PHP Problem
Posted by: alans1234 (86.96.226.---)
Date: November 08, 2009 10:41AM

A newbie question so be gentlesmiling smiley

Wampserver won't run the PHP portions of test scripts. The HTML portion works fine. The following is one example but I have tried several others:

Test.php

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line</p>

<?php
echo "<p>This is a PHP line</p>";
phpinfo();
?>
</body>
</html>

I am running XP Pro and Firefox as my main browser.

As you can see I am using long tags. If I type localhost into the browser it satisfactorily returns "Index of .. " and points to the wampserver "webprojects" directory. A phpmyadmin/index.php command satisfactorily fires up phpmyadmin. So the system is partially working.

My PHP log file is completely empty and I have come round to thinking my bog standard install isn't pointing at the right directories but have now got stuck and am at a loss.

Any help would be much appreciated, I have spent the last week researching forum articles and fixes and definitely need to move on !

Re: PHP Problem
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: November 08, 2009 11:30AM

maybe your file isnt called .php but .php.txt

windows by default hides file extentsions for known types

you shud turn this off


start>control panel>folder options>view(tab)> UNTICK "Hide file extentions for known file types"



now check that your file is name correctly

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

Re: PHP Problem
Posted by: alans1234 (86.96.229.---)
Date: November 08, 2009 11:48AM

Thanks Steve much appreciated

Your suggestion is my default on WinXP but I have double checked anyway and the settings are as you suggest.

I was very careful to check the file extensions a while ago when I first encountered problems. The files definitely have a .php extension. Also, just to make you aware, the files were prepared in notepad++.

Alan

Re: PHP Problem
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: November 08, 2009 12:00PM

ok cool. what is your exact output for the above file..


in IE VIEW -PAGE SOURCE .. and paste it up here

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

Re: PHP Problem
Posted by: alans1234 (86.96.227.---)
Date: November 08, 2009 12:34PM

Firefox Browser Screen Output

This is an HTML line
This is a PHP line

"; phpinfo(); ?>


Firefox View - Page Source Output

<html>
<head>
<title>PHP Test</title>
</head>

<body>
<p>This is an HTML line</p>

<?php
echo "<p>This is a PHP line</p>";
phpinfo();
?>
</body>

</html>

Re: PHP Problem
Posted by: c2dan (---.15-1.cable.virginmedia.com)
Date: November 08, 2009 12:49PM

Make sure you're saving the file in C:/wamp/www

DO NOT open the file directly in to your web browser this will not work. YOU MUST go to [localhost] to run your .php files.

Re: PHP Problem
Posted by: alans1234 (86.96.227.---)
Date: November 08, 2009 01:12PM

Ah ha - that's cracked it. It is the simple things that get you !!!!

For the benefit of others, my file is in the c:/wamp/www directory but I was trying to launch it from the Wampserver www.directory menu. I was confused because htm, html files open up from here just fine. Also ini and conf files in the other directories.

I just wished I had asked a week and a half ago !!

many thanks Steve and Dan

Re: PHP Problem
Posted by: yfastud (Moderator)
Date: November 08, 2009 02:35PM


Re: PHP Problem
Posted by: ERMIS (196.1.218.---)
Date: November 14, 2009 12:31PM

Hi mates,
It seems that I face the same problem in here, c2dan, what do u mean by "YOU MUST go to [localhost] to run your .php files."?

How I can do this ?
sorry for the basic question.

Thnaks...

Re: PHP Problem
Posted by: yfastud (Moderator)
Date: November 14, 2009 09:59PM

as already posted here, to setup basic website, follow this
[blog.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Sorry, only registered users may post in this forum.