ac
ac

Reputation:

XAMPP for Mac cannot see PHP files

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 a blank Firefox window shows up. Can anyone please help?

Upvotes: 2

Views: 15199

Answers (5)

Cyber
Cyber

Reputation: 2704

Check if the below is included in your httpd.conf

Let Apache run phtml files

AddHandler application/x-httpd-php .php .php5 .php4 .php3 .html .htm .phtml

Upvotes: 0

Phill Pafford
Phill Pafford

Reputation: 85298

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 by typing http://localhost in your browser URL. If you see the xampp page come 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.

I just checked for the document root directory on the xampp website. It's /Applications/XAMPP/htdocs/ if you installed the xampp application in the applications directory.

Upvotes: 3

Hannah
Hannah

Reputation: 1

put the folder or files in the (lowercase) xampp folder. Applications/XAMPP/htdocs/xampp then try the url: localhost/xampp/folder/file.php That should work.

Upvotes: 0

Palantir
Palantir

Reputation: 24182

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.

Upvotes: 0

pavium
pavium

Reputation: 15108

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.

Upvotes: -2

Related Questions