tags:

views:

685

answers:

3

Hi, I am unable to see php files after I downloaded XAMPP. I am trying to write a php file, so I download and started XAMPP, but I cannot see PHP files show up. When I open anything as simple as:

<?php
echo "Hello World";
?>

Just shows up a blank firefox window. Can anyone please help, this is urgent! Thanks

A: 

Apache will need a bit of configuration in the httpd.conf file before it treats PHP files with the respect they deserve.

(Only joking about the respect)

I'm using XAMPP for Windows, and I needed to add the following to the httpd.conf file:

LoadModule php5_module "C:/Program Files/xampp/apache/bin/php5apache2.dll"
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml

There may be some more details I've forgotten. It was a long time ago.

pavium
xampp should run out of the box for PHP with no configuration needed, also the question is for installation on a MAC so you LoadModule with a C:/ file base would not work since MAC OSX is based on UNIX
Phill Pafford
But that's why I said "I'm using XAMPP for Windows, and I needed to add the following". I assumed someone reading it would recognise it as a Windows example, and extrapolate.
pavium
A: 

what directory are you using for your PHP files? this needs to be in the htdocs directory in the xampp directory. Check to see if xampp is running but typing http://localhost in your browser URL. If you see the xampp page pull up then it's working fine and you need to check if your PHP files are in the correct location, if nothing shows up then it's xampp that's not working.

Just checked for the document root directory on the xampp website: /Applications/XAMPP/htdocs/ if you installed the xampp application in the applications directory

Phill Pafford
A: 

It's hard to guess without an error message. Try this: edit your php.ini (I don't know where this would be in XAMPP, but you should be able to find it) and look for this variable setting:

display_errors

if it is set to Off, turn it to On, then restart XAMPP. When you load the page, you should see some meaningful error message on the screen.

Palantir