Question from TOTAL Newbie to XAMPP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Question from TOTAL Newbie to XAMPP

Postby Ian Stewart » 18. May 2009 01:26

I currently have around 80 pages of .html (using .css) uploaded.
I now wish to use the <?php include(****.html"); ?> command to cut down on maintenance of menu items.
I have experimented with a couple of pages and, when these new .php pages are uploaded, they render correctly.

I installed the XAMPP package to be able to check and correct these revised pages prior to uploading.

The files reside in - C:/xampp/htdocs/website
However, using Firefox, I cannot see the page(s) rendered correctly on my local machine.
(Albeit they are OK once uploaded)
Only the main body text shows . . . nothing of the <?php include(****.html"); ?>

Is this a configuration problem with XAMPP ?
Do I need to install additional packages for PHP ?
Or does my problem lie elsewhere ?

Any help appreciated.
Ian Stewart
 
Posts: 3
Joined: 16. May 2009 16:09

Re: Question from TOTAL Newbie to XAMPP

Postby Sharley » 18. May 2009 01:35

How are you opening your files?

By default:
http://localhost/website/yourfile.php or similar should parse the php code.
http://localhost/website/yourfile.html would not parse the php code.

If all your files with php code content have a .html extension and you don't want to change them all to having a php extension then this post may help:
viewtopic.php?f=16&t=34525
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Question from TOTAL Newbie to XAMPP

Postby Ian Stewart » 18. May 2009 03:24

Sharley wrote:How are you opening your files?


Right-click on file and 'open with Firefox'

By default:
http://localhost/website/yourfile.php or similar should parse the php code.
http://localhost/website/yourfile.html would not parse the php code.

If all your files with php code content have a .html extension and you don't want to change them all to having a php extension then this post may help:
viewtopic.php?f=16&t=34525


I added the lines as suggested in the above :
AddType application/x-httpd-php .html
AddHandler application/x-httpd-php .html
but it doesn't appear to make a difference
I'm only refreshing Apache thro' the control panel, I'll see what happens once I re-boot

Thanks for the response.
Ian Stewart
 
Posts: 3
Joined: 16. May 2009 16:09

Re: Question from TOTAL Newbie to XAMPP

Postby Sharley » 18. May 2009 03:30

Right-click on file and 'open with Firefox'
This is incorrect as the file needs to be parsed by the server not the browser - unlike html code that is parsed by the browser and can be opened directly in a browser.

You need to open a .php coded file using a URI as I pointed out in my first post, for example:
http://localhost/website/yourfile.php

Or after editing the httpd-xampp.conf file and php code within a .html file:
http://localhost/website/yourfile.html

In other words if you have php code in a file either .php or .html, it has to be parsed by the server.

When ever you edit a server configuration file you must restart the server (stop then start Apache not refresh the Control Panel) to have the edits recognized.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: Question from TOTAL Newbie to XAMPP

Postby Ian Stewart » 18. May 2009 14:43

Sharley wrote:You need to open a .php coded file using a URI as I pointed out in my first post, for example:
http://localhost/website/yourfile.php

Or after editing the httpd-xampp.conf file and php code within a .html file:
http://localhost/website/yourfile.html

In other words if you have php code in a file either .php or .html, it has to be parsed by the server.

When ever you edit a server configuration file you must restart the server (stop then start Apache not refresh the Control Panel) to have the edits recognized.


Great, everything now appears to be working as expected.

My apologies, I hadn't fully understood what you explained in your first response.
(Obviously my brain wasn't functioning at 100% !)

Thanks very much for your help, I can now get on with the rest of the pages.
Ian Stewart
 
Posts: 3
Joined: 16. May 2009 16:09


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 83 guests