Webpages displaying directory contents

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Webpages displaying directory contents

Postby dap1 » 31. December 2013 03:41

Hi Apache Friends,

When navigating to http://localhost/ the page is displaying the directory's contents instead of rendering the page's index.php.

I feel like I'm missing something simple. I have Apache and MySQL running on a Mac OSX. This is not a clean install. It has been modified a few times.

Thanks in advance.
dap1
 
Posts: 5
Joined: 31. December 2013 03:31
Operating System: Mac OS X

Re: Webpages displaying directory contents

Postby dap1 » 31. December 2013 20:54

It looks like my PHP is not running, although I have Apache and MySQL running through the XAMPP control panel.

I added:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

So I don't get a list of files in my directory when navigating to http://localhost/, but instead I get plain text of the index.php file:
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/xampp/');
exit;
?>
Something is wrong with your XAMPP installation :-(

Note: I am not navigating directly to a .php page.
dap1
 
Posts: 5
Joined: 31. December 2013 03:31
Operating System: Mac OS X

Re: Webpages displaying directory contents

Postby dap1 » 31. December 2013 21:01

In php.ini, I do have php short tags turned on:
short_open_tag = On
dap1
 
Posts: 5
Joined: 31. December 2013 03:31
Operating System: Mac OS X

Re: Webpages displaying directory contents

Postby dap1 » 31. December 2013 21:12

I notice when stopping/starting Apache, the log file doesn't load PHP/5.3.1:
[Tue Dec 31 12:10:05 2013] [notice] caught SIGTERM, shutting down
[Tue Dec 31 12:10:08 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 31 12:10:09 2013] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 31 12:10:09 2013] [notice] Digest: done
[Tue Dec 31 12:10:09 2013] [notice] Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 configured -- resuming normal operations
dap1
 
Posts: 5
Joined: 31. December 2013 03:31
Operating System: Mac OS X

Re: Webpages displaying directory contents

Postby dap1 » 31. December 2013 21:21

It works now. In my httpd.conf file, I added the line below to load php. Not sure how that was removed.
LoadModule php5_module modules/libphp5.so

Thanks for all your help! Lol
dap1
 
Posts: 5
Joined: 31. December 2013 03:31
Operating System: Mac OS X


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 18 guests