Cant get php to work..
Posted by: Hylsan (---.hassleholm.se)
Date: July 07, 2009 02:40PM

Ive got a htm.file with php-code and I cant get the php-section to work.

Everything that isnt included in "<PHP ?>" shows alright.

Making the files with the program CoffeeCup Free editor, and I havnt had any problem on other machines.

Any ideas?

Server Configuration
Apache Version : 2.2.11
PHP Version : 5.2.9-2
MySQL Version : 5.1.33

/Hylsan



Edited 1 time(s). Last edit at 07/07/2009 02:42PM by Hylsan.

Options: ReplyQuote
Re: Cant get php to work..
Posted by: yfastud (Moderator)
Date: July 07, 2009 03:35PM

Quote

Everything that isnt included in "<PHP ?>" shows alright.
it should be lower case and have ? before php, so correct is <?php ... ?>
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

Options: ReplyQuote
Re: Cant get php to work..
Posted by: toumimi (---.237.115-78.rev.gaoland.net)
Date: July 07, 2009 03:38PM

Hi,

It should be a type mistake but you should use <?PHP ?>.
Then, you can't use php into htm or html file if you don't force it into apache configuration.
Open httpd.conf (from wamp menu)
Find those lines
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3

and there you can set a new association : htm file is considerated as a php file (contains php sections)
AddType application/x-httpd-php .htm

Another solution is to rename your file with a php extension.

Note that to test a php file, you have to use [localhost] (not file://___)

Florian

WampServer Patch (Screenshots)
Topic EN : www.wampserver.com
Topic FR : www.wampserver.com

Options: ReplyQuote
Re: Cant get php to work..
Posted by: Hylsan (---.hassleholm.se)
Date: July 08, 2009 08:09AM

Thanks for all replies!
Yes Ít was a typo from my side <?php...?> it is smiling smiley

But after inserting the addType-line into httpd.conf it all works fine.
I like to keep the mixed html-php-files with extension .htm and pure php with .php just to keep track of them.

Thanks!
/Hylsan

Options: ReplyQuote


Sorry, only registered users may post in this forum.